fix(generator): copy top-level assets

This commit is contained in:
thePR0M3TH3AN
2025-07-10 12:59:29 -04:00
parent 792b02799d
commit adea90aa1f

View File

@@ -155,12 +155,18 @@ async function generate({ contentDir = 'content', outputDir = '_site', configPat
await fs.promises.copyFile(srcPath, destPath); await fs.promises.copyFile(srcPath, destPath);
} }
// Copy project level assets folder into output // Copy the main assets directory (theme, js, etc.)
const projectAssets = path.resolve(__dirname, '..', '..', 'assets'); const mainAssetsSrc = path.resolve(
if (fs.existsSync(projectAssets)) { configPath ? path.dirname(configPath) : process.cwd(),
const dest = path.join(outputDir, 'assets'); '..',
await fs.promises.mkdir(dest, { recursive: true }); 'assets'
await fs.promises.cp(projectAssets, dest, { recursive: true }); );
const mainAssetsDest = path.join(outputDir, 'assets');
if (fs.existsSync(mainAssetsSrc)) {
console.log(`Copying main assets from ${mainAssetsSrc} to ${mainAssetsDest}`);
// Use fs.promises.cp for modern Node.js, it's like `cp -R`
await fs.promises.cp(mainAssetsSrc, mainAssetsDest, { recursive: true });
} }
} }