TorbatYar/frontend/scripts/validate-healthcare-bundle.mjs
Mortezakoohjani 6f4a484051 Migrate Beauty, Healthcare, and Accounting frontend to modular src/modules architecture.
Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:28:27 +03:30

38 lines
1.1 KiB
JavaScript

#!/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);