master
Colby Knox Merge PR #181: Add circuit generators that follow rendered text contours b00fdcb 18d ago
#!/usr/bin/env node
// Syntax gate: node --check over every script the studio ships, page scripts
// included. A page script that fails to parse leaves the surface blank and the
// render view composing the generic mock (hero-studio#59), and nothing else
// in the suite loads public/js directly.
import { execFileSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
const files = [
  ...fs.readdirSync(path.join(ROOT, 'public/js')).filter((f) => /\.m?js$/.test(f)).map((f) => 'public/js/' + f),
  ...fs.readdirSync(path.join(ROOT, 'public/vendor/circuit-trace-generators')).filter((f) => f.endsWith('.js')).map((f) => 'public/vendor/circuit-trace-generators/' + f),
  ...fs.readdirSync(ROOT).filter((f) => /\.(m|c)?js$/.test(f)),
  ...fs.readdirSync(path.join(ROOT, 'test')).filter((f) => /\.m?js$/.test(f)).map((f) => 'test/' + f),
];
let bad = 0;
for (const f of files) {
  try { execFileSync(process.execPath, ['--check', path.join(ROOT, f)], { stdio: 'pipe' }); console.log('  ok   ' + f); }
  catch (e) { bad++; console.log('  FAIL ' + f + '\n' + String(e.stderr || e.message).split('\n').slice(0, 5).map((l) => '       ' + l).join('\n')); }
}
console.log('\n' + (files.length - bad) + ' passed, ' + bad + ' failed');
process.exit(bad ? 1 : 0);