63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
const main = readFileSync("src/styles/main.css", "utf8");
|
|
const unified = readFileSync("src/styles/unified-page.css", "utf8");
|
|
|
|
const requiredMainTokens = [
|
|
"--ctms-primary",
|
|
"--ctms-text-main",
|
|
"--ctms-bg-base",
|
|
"--ctms-radius",
|
|
"--ctms-shadow",
|
|
"--ctms-brand-900",
|
|
"--ctms-brand-700",
|
|
"--ctms-neutral-100",
|
|
"--ctms-neutral-300",
|
|
"--ctms-focus-ring"
|
|
];
|
|
|
|
const requiredUnifiedTokens = [
|
|
"--unified-shell-bg",
|
|
"--unified-shell-radius",
|
|
".unified-action-bar",
|
|
".unified-section",
|
|
".ctms-page-shell",
|
|
".ctms-page-header-row",
|
|
".ctms-page-content-grid"
|
|
];
|
|
|
|
const missing = [
|
|
...requiredMainTokens.filter((t) => !main.includes(t)),
|
|
...requiredUnifiedTokens.filter((t) => !unified.includes(t))
|
|
];
|
|
|
|
const pageContractChecks = [
|
|
"src/views/ia/ProjectMilestones.vue",
|
|
"src/views/ia/SubjectManagement.vue",
|
|
"src/views/ia/RiskIssueSae.vue",
|
|
"src/views/ia/RiskIssuePd.vue",
|
|
"src/views/ia/RiskIssueMonitoringVisits.vue"
|
|
];
|
|
|
|
const requiredPageClasses = [
|
|
"ctms-page-shell",
|
|
"unified-action-bar",
|
|
"ctms-table-card"
|
|
];
|
|
|
|
for (const file of pageContractChecks) {
|
|
const content = readFileSync(file, "utf8");
|
|
for (const className of requiredPageClasses) {
|
|
if (!content.includes(className)) {
|
|
missing.push(`${file}:${className}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (missing.length) {
|
|
console.error("UI contract check failed. Missing:", missing.join(", "));
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log("UI contract check passed");
|