* chore: add one-time index html repair script * chore: run one-time html repair on fix branch * fix: close mobile style block [html-repair] * chore: remove one-time html repair workflow * chore: remove one-time html repair script * test: add html style integrity checks * test: enforce html integrity in deploy checks --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
12 lines
718 B
JavaScript
12 lines
718 B
JavaScript
import fs from 'node:fs';
|
|
const html=fs.readFileSync('public/index.html','utf8');
|
|
let bad=0;
|
|
const check=(value,message)=>{console.log(`${value?'OK':'FAIL'}: ${message}`);if(!value)bad++};
|
|
const opens=(html.match(/<style(?:\s|>)/gi)||[]).length;
|
|
const closes=(html.match(/<\/style>/gi)||[]).length;
|
|
check(opens===closes,`style tags balanced (${opens} open / ${closes} close)`);
|
|
check(!html.includes('}<style id="sun-composition-v1757">'),'mobile style is not nested into composition style');
|
|
check(html.includes('}</style><style id="sun-composition-v1757">'),'mobile style closes before composition style');
|
|
check(/<\/style>\s*<\/head>/i.test(html),'last head style is closed before </head>');
|
|
if(bad)process.exit(1);
|