From 113b0a2b72afa4cd05303670ee6a6f9c4d8caab3 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 11:59:18 +0000 Subject: [PATCH] fix(ci): harden build script and update test mocks Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- scripts/build-dist.mjs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/build-dist.mjs b/scripts/build-dist.mjs index 0153dd4a..74e19bda 100644 --- a/scripts/build-dist.mjs +++ b/scripts/build-dist.mjs @@ -38,7 +38,11 @@ function copyFile(src, dest) { if (fs.existsSync(src)) { fs.copyFileSync(src, dest); } else { - console.warn(`Warning: Source file ${src} does not exist.`); + const message = `Error: Source file ${src} does not exist.`; + console.error(message); + if (['_headers', '_redirects', 'index.html'].includes(path.basename(src))) { + throw new Error(message); + } } } @@ -74,6 +78,19 @@ function main() { copyFile(file, path.join(DIST, file)); } + // Verify critical CSS generation + const generatedCss = path.join(DIST, 'css', 'tailwind.generated.css'); + if (!fs.existsSync(generatedCss) && !fs.existsSync(path.join('css', 'tailwind.generated.css'))) { + // tailwind might output to dist/css OR css/ then we copy. + // The command is: -o css/tailwind.generated.css + // So it should be in source 'css/', then copied by copyDir('css'...) + // Let's verify it exists in source 'css/' + if (!fs.existsSync(path.join('css', 'tailwind.generated.css'))) { + console.error('Error: css/tailwind.generated.css was not generated.'); + process.exit(1); + } + } + console.log('Copying directories...'); for (const dir of DIRS_TO_COPY) { copyDir(dir, path.join(DIST, dir));