fix: Ensure version info visibility and build robustness

- Moved `<!-- VERSION_INFO -->` out of `.fade-in` container in `index.html` to prevent visibility issues if JS fails.
- Added verification in `scripts/build-dist.mjs` to ensure `dist/components` exists and is not empty.
- Added logging to `scripts/build-dist.mjs` for version injection status.
- Updated `scripts/verify-dist-deploy-artifact.mjs` regex to accommodate HTML structure change.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-11 14:15:52 +00:00
1 parent 6210b1045d
commit 6a284e0b2d
5 files changed
+10 -34

No files matched your search

+7
View File
@@ -178,6 +178,7 @@ function injectVersionInfo() {
fs.writeFileSync(indexHtmlPath, content);
console.log(`Injected version: ${hash.slice(0, 8)} • ${date}`);
} else {
console.warn('Warning: <!-- VERSION_INFO --> placeholder not found. Attempting regex fallback...');
// Fallback search if placeholder is missing (legacy behavior)
const taglineRegex = /(seed\. zap\. subscribe\.\s*<\/h2>)/;
if (taglineRegex.test(content)) {
@@ -244,6 +245,12 @@ function main() {
copyDir(dir, path.join(DIST, dir));
}
// Verify components were copied (critical for client-side injection)
const componentsDist = path.join(DIST, 'components');
if (!fs.existsSync(componentsDist) || fs.readdirSync(componentsDist).length === 0) {
throw new Error('Critical Error: dist/components directory is missing or empty.');
}
console.log('Generating hashed asset manifest...');
const manifest = generateHashedAssetManifest();
+1 -1
View File
@@ -5,7 +5,7 @@ import path from 'node:path';
const DIST_DIR = 'dist';
const INDEX_PATH = path.join(DIST_DIR, 'index.html');
const MANIFEST_PATH = path.join(DIST_DIR, 'asset-manifest.json');
const VERSION_MARKUP_PATTERN = /seed\.\s*zap\.\s*subscribe\.\s*<\/h2>\s*<div[^>]*>\s*v:\s*[a-f0-9]{8}\s*•\s*\d{4}-\d{2}-\d{2}\s*<\/div>/i;
const VERSION_MARKUP_PATTERN = /seed\.\s*zap\.\s*subscribe\.\s*<\/h2>[\s\S]*?v:\s*[a-f0-9]{8}\s*•\s*\d{4}-\d{2}-\d{2}/i;
function readUtf8(filePath) {
if (!fs.existsSync(filePath)) {