файл пакета→ .shtukbase/packages/shtukbase-ui-html/checks/fresh.ts
checks/fresh.ts
22 строки, 1.0 КБ.
Файл как есть в пакете: код и комментарии в нём не переводятся.
- // SUI-R03. /design/shtukbase-ui-html/ui.css is exactly what `build` writes from the current component CSS. A broken
- // component is SUI-R01's business: this check then stays quiet.
- import { existsSync, readFileSync } from 'node:fs';
- import { join } from 'node:path';
- import { build } from '../actions/build.ts';
- import { LIB_DIR } from '../lib/components.ts';
- export const RULE = { id: 'sui-r03', title: 'ui.css is rebuilt from the component CSS' };
- export function check(root = process.cwd()): string[] {
- const { problems, css } = build(root);
- if (problems.length) return [];
- const p = join(root, LIB_DIR, 'ui.css');
- if (!existsSync(p)) return [`${LIB_DIR}/ui.css: the file is missing; build it: shtuk run shtukbase-ui-html build`];
- return readFileSync(p, 'utf8') === css ? [] : [`${LIB_DIR}/ui.css: does not match the component CSS; rebuild: shtuk run shtukbase-ui-html build (this file is not edited by hand)`];
- }
- if (import.meta.main) {
- const out = check();
- for (const l of out) console.log(l);
- process.exitCode = out.length ? 1 : 0;
- }