myst-cli
Version:
Command line tools for MyST
13 lines (12 loc) • 529 B
JavaScript
import { basename, join, resolve } from 'node:path';
import fs from 'fs-extra';
export function copyStaticFiles(session, staticFiles, destDir, projectPath) {
for (const fn of staticFiles) {
const resolvedFn = resolve(projectPath, fn);
if (!fs.existsSync(resolvedFn)) {
session.log.warn(`Static file not found: "${fn}" (paths are resolved relative to the project root: ${projectPath})`);
continue;
}
fs.copySync(resolvedFn, join(destDir, basename(resolvedFn)));
}
}