#!/usr/bin/env node /** Post-build bundle check for healthcare routes. */ import { existsSync, readdirSync, statSync } from "node:fs"; import { join } from "node:path"; import { fileURLToPath } from "node:url"; const ROOT = join(fileURLToPath(new URL(".", import.meta.url)), ".."); const NEXT_HC = join(ROOT, ".next", "server", "app", "healthcare"); console.log("Healthcare Bundle Validation\n"); if (!existsSync(join(ROOT, ".next"))) { console.error("❌ Run npm run build first"); process.exit(1); } if (!existsSync(NEXT_HC)) { console.error("❌ No compiled healthcare routes"); process.exit(1); } function countRoutes(dir) { let n = 0; for (const e of readdirSync(dir)) { const f = join(dir, e); if (statSync(f).isDirectory()) n += countRoutes(f); else if (e.startsWith("page.")) n++; } return n; } const count = countRoutes(NEXT_HC); console.log(`✅ Compiled healthcare route segments: ${count}`); if (count < 50) { console.error(`❌ Expected >= 50, got ${count}`); process.exit(1); } process.exit(0);