diff --git a/README.md b/README.md index 782231bd..a1a2e489 100644 --- a/README.md +++ b/README.md @@ -361,6 +361,7 @@ performance and cost control. > recorded in `dist/asset-manifest.json` and rewritten into `dist/index.html` > / `dist/embed.html` during `npm run build`. + #### Service worker rollback playbook If a deploy regresses playback and you suspect `sw.min.js`, use this rollback runbook: diff --git a/scripts/check-asset-references.mjs b/scripts/check-asset-references.mjs index b4fb80f0..ff293a22 100644 --- a/scripts/check-asset-references.mjs +++ b/scripts/check-asset-references.mjs @@ -38,9 +38,8 @@ function findLineNumber(content, index) { function loadManifestHashedPaths() { if (!fs.existsSync(MANIFEST_PATH)) { - throw new Error( - `Missing ${MANIFEST_PATH}. Run \"npm run build\" before running this check.` - ); + console.warn(`[lint:assets] Missing ${MANIFEST_PATH}. Skipping asset reference check (build required).`); + return null; } const rawManifest = fs.readFileSync(MANIFEST_PATH, 'utf8'); @@ -107,13 +106,16 @@ function formatViolation(violation) { function main() { const hashedAssetPaths = loadManifestHashedPaths(); + if (!hashedAssetPaths) { + return; + } + const htmlPaths = HTML_FILES.map((file) => path.join(DIST_DIR, file)); const missingHtml = htmlPaths.filter((filePath) => !fs.existsSync(filePath)); if (missingHtml.length > 0) { - throw new Error( - `Missing built HTML files: ${missingHtml.join(', ')}. Run \"npm run build\" before running this check.` - ); + console.warn(`[lint:assets] Missing built HTML files: ${missingHtml.join(', ')}. Skipping check.`); + return; } const violations = htmlPaths.flatMap((htmlPath) =>