Merge pull request #19 from PR0M3TH3AN/codex/update-generator-script-to-copy-assets

Ensure assets copied during build
This commit is contained in:
thePR0M3TH3AN
2025-07-10 13:00:19 -04:00
committed by GitHub

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 });
} }
} }