@schemifyjs/schematics
Version:
Reusable schematics for scaffolding SchemifyJS projects.
13 lines (12 loc) • 477 B
JavaScript
import fs from 'fs-extra';
import path from 'path';
import { TemplateNotFoundError } from '../errors/template-not-found.error.js';
export async function copyTemplateFiles(source, destination) {
const exists = await fs.pathExists(source);
if (!exists)
throw new TemplateNotFoundError(source);
await fs.copy(source, destination, {
overwrite: true,
filter: (src) => !['node_modules', 'dist', '.DS_Store'].includes(path.basename(src))
});
}