chore: update css rules, add hct plugin

This commit is contained in:
2026-09-02 09:51:14 +05:00
parent 1310c51543
commit 98a4bacd23
13 changed files with 690 additions and 152 deletions
+51
View File
@@ -0,0 +1,51 @@
// Design-token audit, one command: theme parity, hct-only color authorship and
// unused-token warnings over src/preview.css.
//
// Usage: pnpm --dir web exec node scripts/check-tokens.mjs
// Exit code 1 when a failing check (parity or color authorship) reports.
import { FILE, parsePreview } from "./token-audit/helpers.mjs";
import { checkParity } from "./token-audit/parity.mjs";
import { checkColorAuthorship } from "./token-audit/colors.mjs";
import { checkUnused } from "./token-audit/unused.mjs";
async function main() {
const { root, light, dark } = await parsePreview();
let failed = false;
const parityErrors = checkParity({ light, dark });
if (parityErrors.length > 0) {
console.log(
`Token parity violations in ${FILE}:\n${parityErrors.join("\n")}`,
);
failed = true;
} else {
console.log(
"Token parity: OK — all color tokens have both light/dark forms.",
);
}
const colorErrors = checkColorAuthorship(root);
if (colorErrors.length > 0) {
console.log(`Non-hct color values in ${FILE}:\n${colorErrors.join("\n")}`);
failed = true;
} else {
console.log("All colors are authored as hct().");
}
const unused = checkUnused(root);
if (unused.length > 0) {
console.log("\nUnused tokens (defined in preview.css, never used):");
for (const token of unused) console.log(` ${token}`);
} else {
console.log("All preview.css tokens are used somewhere.");
}
if (failed) process.exitCode = 1;
}
main().catch((error) => {
console.log(error);
process.exitCode = 1;
});