سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 18:15 UTC
Expand phase 1 loader integrity checks
davoodmehraban89 committed
Sep 28, 2026 at 14:58 UTC
7b90ba718616040c2a9da17d11bee0a21b9c99db
1 file changed
+4
scripts/quality-check.mjs
+4
@@ -14,6 +14,10 @@ const requiredScripts=['js/core.js','js/sync.js','js/invoices.js','js/print.js',
14
if(index.includes('</script>\\n<script'))throw new Error('Literal \\n found between script tags');
15
for(const s of requiredScripts)if(!index.includes(s))throw new Error('Missing script load: '+s);
16
17
+if(index.includes('</script>\\n<script'))throw new Error('Literal \\n found between script tags');
18
+const scriptSrc=[...index.matchAll(/<script\s+src="([^"]+)"/g)].map(m=>m[1].split('?')[0]);
19
+const duplicateScripts=[...new Set(scriptSrc.filter((s,i)=>scriptSrc.indexOf(s)!==i))];
20
+if(duplicateScripts.length)throw new Error('Duplicate script loads: '+duplicateScripts.join(', '));
21
const files=fs.readdirSync(path.join(root,'js')).filter(n=>n.endsWith('.js'));
22
const all=Object.fromEntries(files.map(n=>[n,fs.readFileSync(path.join(root,'js',n),'utf8')]));
23
const must={