#!/usr/bin/env node /** * Local verification: generator, TypeScript, shell scripts, production build. * Usage: npm run verify or node scripts/verify.cjs */ "use strict"; const { execSync } = require("node:child_process"); const path = require("node:path"); process.chdir(path.join(__dirname, "..")); function run(label, cmd) { console.log(`\n━━ ${label} ━━`); execSync(cmd, { stdio: "inherit", shell: "/bin/bash" }); } try { run("onion config generator", "node scripts/generate-onion-config.cjs"); run("TypeScript (tsc --noEmit)", "npx tsc --noEmit"); run( "bash syntax (start.sh, install, backup, restore, systemd, health)", "bash -n start.sh && bash -n scripts/install-tor-onion.sh && bash -n scripts/install-systemd.sh && bash -n scripts/health-check-stack.sh && bash -n scripts/list-onion-urls.sh && bash -n scripts/backup-onion-keys.sh && bash -n scripts/restore-onion-keys.sh", ); run("Next.js production build", "npm run build"); console.log("\n✓ verify: all checks passed.\n"); } catch { console.error("\n✗ verify failed. If build hit EACCES on .next/, run:"); console.error(" sudo bash scripts/fix-next-perms.sh\n"); process.exit(1); }