import { readFileSync, readdirSync, existsSync } from 'fs'; import { join } from 'path'; // TODO(shared extraction): this audits legacy pre-SvelteKit `/public/*.html` // script tags. this repo's webui/ is SvelteKit-based (no per-service `public/` HTML pages), and // none of the sibling monorepo service directories below live inside this repo anymore (they're // now separate repos: MediaModerator, MediaTools, MediaKiosk, MediaViewer). The existsSync guard // below means this currently no-ops safely (nothing to audit) rather than erroring. Left as-is // rather than guessing at a SvelteKit-equivalent audit — remove or repurpose if useful. const projects = ['MediaModerator', 'MediaTools', 'MediaKiosk', 'MediaViewer']; const scriptSrcRe = /]+src="([^"]+)"[^>]*>/g; projects.forEach(proj => { const pubDir = join(proj, 'public'); if (!existsSync(pubDir)) return; const htmlFiles = readdirSync(pubDir) .filter(f => f.endsWith('.html')) .sort(); console.log(`=== ${proj} ===`); htmlFiles.forEach(htmlFile => { const content = readFileSync(join(pubDir, htmlFile), 'utf8'); const scripts = []; let m; scriptSrcRe.lastIndex = 0; while ((m = scriptSrcRe.exec(content)) !== null) scripts.push(m[1]); console.log(` ${htmlFile} -> ${scripts.join(', ')}`); }); console.log(); });