TorbatYar/frontend/scripts/validate-experience-routes.mjs
Mortezakoohjani 0eec9f729b feat(experience): deploy Experience frontend FE-11.0-11.5 portal
Commit completed Torbat Pages admin frontend module, BFF proxy, routes, and validation artifacts for official platform deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 21:01:50 +03:30

37 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
/** Validates thin app/experience routes — max 25 lines, import from @/modules/experience */
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const APP = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "app", "experience");
const MAX_LINES = 25;
let errors = [];
function walk(dir) {
for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
const p = path.join(dir, ent.name);
if (ent.isDirectory()) walk(p);
else if (ent.name === "page.tsx") check(p);
}
}
function check(file) {
const rel = path.relative(APP, file);
const content = fs.readFileSync(file, "utf8");
const lines = content.split("\n").length;
if (lines > MAX_LINES) errors.push(`${rel}: ${lines} lines (max ${MAX_LINES})`);
if (!content.includes("@/modules/experience/")) {
errors.push(`${rel}: must import from @/modules/experience/`);
}
}
if (fs.existsSync(APP)) walk(APP);
else errors.push("app/experience not found");
if (errors.length) {
console.error("Experience route validation failed:\n" + errors.map((e) => " - " + e).join("\n"));
process.exit(1);
}
console.log("Experience routes OK");