#!/usr/bin/env node const fs = require('fs'); const path = require('path'); function walk(dir, out = []) { for (const name of fs.readdirSync(dir)) { if (['node_modules', 'dist', 'unpackage', '.git', 'docs'].includes(name)) continue; const p = path.join(dir, name); const st = fs.statSync(p); if (st.isDirectory()) walk(p, out); else if (name.endsWith('.vue')) out.push(p); } return out; } const files = walk('.'); let scss = 0, cssAttr = 0, noLang = 0; const noLangSamples = []; for (const f of files) { const src = fs.readFileSync(f, 'utf8'); const re = /]*)>/gi; let m; while ((m = re.exec(src))) { const attrs = m[1]; if (/lang=["']scss["']/i.test(attrs)) scss++; else if (/lang=["']/i.test(attrs)) cssAttr++; else { noLang++; if (noLangSamples.length < 20) noLangSamples.push(path.relative('.', f)); } } } console.log('scss blocks:', scss, '| lang=css blocks:', cssAttr, '| no-lang blocks:', noLang); if (noLangSamples.length) { console.log('--- no-lang sample ---'); console.log(noLangSamples.join('\n')); }