47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
const css = readFileSync("app/globals.css", "utf8");
|
|
const files = [
|
|
"app/page.tsx",
|
|
"app/messages/page.tsx",
|
|
"app/keys/page.tsx",
|
|
"app/domains/page.tsx",
|
|
"app/suppressions/page.tsx",
|
|
"app/metrics/page.tsx",
|
|
"app/page-header.tsx",
|
|
"app/empty-state.tsx",
|
|
];
|
|
const app = files.map((file) => readFileSync(file, "utf8")).join("\n");
|
|
|
|
const tokens = [
|
|
"--am-seite",
|
|
"--am-flaeche-1",
|
|
"--am-text-primaer",
|
|
"--am-handlung-ruhend",
|
|
"--am-handlung-text",
|
|
"--am-seitentitel",
|
|
"--am-navigation-breite",
|
|
"--am-raum-4",
|
|
"--am-radius-mittel",
|
|
"--am-ziel-beruehrung",
|
|
];
|
|
const classes = ["seitenkopf", "kennzahlen", "kennzahl", "tabelle", "werkzeugleiste", "karte", "leerzustand", "feld", "btn"];
|
|
|
|
const errors = [];
|
|
for (const token of tokens) {
|
|
if (!new RegExp(`${token}\\s*:`).test(css)) errors.push(`Token fehlt: ${token}`);
|
|
}
|
|
for (const name of classes) {
|
|
if (!new RegExp(`\\.${name}(?:[^a-z-]|$)`).test(css)) errors.push(`CSS-Klasse fehlt: ${name}`);
|
|
if (!app.includes(name)) errors.push(`Markup nutzt ${name} nicht`);
|
|
}
|
|
if (/\bds-button\b/.test(app)) errors.push("Altbestand: ds-button im Markup");
|
|
if (/\bds-input\b/.test(app)) errors.push("Altbestand: ds-input im Markup");
|
|
|
|
if (errors.length) {
|
|
console.error("CI-Check fehlgeschlagen:");
|
|
for (const error of errors) console.error(" - " + error);
|
|
process.exit(1);
|
|
}
|
|
console.log("CI-Check ok: Token, Bausteinklassen und Markup sind vorhanden.");
|