archivo del paquete→ .shtukbase/packages/shtukbase-style/checks/fresh.ts
checks/fresh.ts
19 líneas, 1.1 KB.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // SBS-R05. The CSS of the style is up to date: /design/shtukbase-style/tokens.css is exactly what `build` writes from
- // the style's tokens. Invalid tokens are the business of the design-tokens checks: this check then stays quiet.
- import { existsSync, readFileSync } from 'node:fs';
- import { join } from 'node:path';
- import { report } from '../../design-base/lib/files.ts';
- import { buildStyle, CSS, DIR } from '../lib/stylelib.ts';
- export const RULE = { id: 'sbs-r05', title: 'The CSS of the style is rebuilt from its tokens' };
- export function check(root = process.cwd()): string[] {
- if (!existsSync(join(root, DIR))) return [];
- const { text, problems } = buildStyle(root);
- if (problems.length) return [];
- const p = join(root, CSS);
- if (!existsSync(p)) return [`${CSS}: the file is missing — build it: shtuk run shtukbase-style build`];
- return readFileSync(p, 'utf8') === text ? [] : [`${CSS}: does not match the tokens of the style — rebuild: shtuk run shtukbase-style build (this file is not edited by hand)`];
- }
- if (import.meta.main) report(check());