in scripts/generate.js [89:118]
function copyDirectory(src, dest) {
// Check if source directory exists
if (!fs.existsSync(src)) {
console.error(chalk.red(`Source directory "${src}" does not exist.`));
return;
}
// Create the destination directory if it does not exist
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true });
}
// Read all files and directories in the source directory
const items = fs.readdirSync(src);
// Iterate over each item in the directory
items.forEach((item) => {
const srcPath = path.join(src, item);
const destPath = path.join(dest, item);
const stats = fs.statSync(srcPath);
if (stats.isDirectory()) {
// If the item is a directory, recursively copy its contents
copyDirectory(srcPath, destPath);
} else {
// If the item is a file, copy it to the destination
fs.copyFileSync(srcPath, destPath);
}
});
}