import { readdirSync, readFileSync } from "fs"; import { join } from "path"; const ROUTES_DIR = "server/routes"; const LINE_LIMIT = 650; const files = readdirSync(ROUTES_DIR).filter((f) => f.endsWith(".ts")); let violations = 0; for (const file of files) { const filePath = join(ROUTES_DIR, file); const lines = readFileSync(filePath, "utf-8").split("\n").length; if (lines > LINE_LIMIT) { console.error( `❌ ${filePath}: ${lines} lines (limit is ${LINE_LIMIT})` ); violations++; } } if (violations > 0) { console.error( `\n${violations} file(s) exceed the ${LINE_LIMIT}-line limit. Split them into smaller modules before merging.` ); process.exit(1); } else { console.log(`✅ All ${files.length} route files are within the ${LINE_LIMIT}-line limit.`); }