// For copying pages and assets const fs = require('fs'); const path = require('path'); const ROOT = path.join(__dirname, '..'); const SRC = path.join(ROOT, 'source'); const DEST = path.join(ROOT, 'build', 'app'); // Server-side dirs or dirs with their own build step — skip const SKIP = new Set(['server', 'locale-data', 'locales', 'library-ts', 'pages']); function copyStatic(src, dest) { fs.mkdirSync(dest, { recursive: true }); for (const entry of fs.readdirSync(src, { withFileTypes: true })) { const srcPath = path.join(src, entry.name); const destPath = path.join(dest, entry.name); if (entry.isDirectory()) { copyStatic(srcPath, destPath); } else if (!entry.name.endsWith('.ts')) { fs.copyFileSync(srcPath, destPath); } } } // Copy HTML pages const pagesDir = path.join(SRC, 'pages'); fs.mkdirSync(DEST, { recursive: true }); for (const file of fs.readdirSync(pagesDir)) { if (file.endsWith('.html')) { fs.copyFileSync(path.join(pagesDir, file), path.join(DEST, file)); } } // Copy all non-TS static assets (CSS, SVG, etc.) from frontend source dirs for (const entry of fs.readdirSync(SRC, { withFileTypes: true })) { if (entry.isDirectory() && !SKIP.has(entry.name)) { copyStatic(path.join(SRC, entry.name), path.join(DEST, entry.name)); } }