package file→ .shtukbase/packages/design-lenses/actions/check.ts
actions/check.ts
21 lines, 743 B.
- // Action `check`: exit 1 when lib/design/style.data.js is missing or does not match the chosen style.
- import { existsSync, readFileSync } from 'node:fs';
- import { join } from 'node:path';
- import { OUT, expectedText } from '../lib/project.ts';
- const root = process.cwd();
- const { text, error } = expectedText(root);
- if (!text) {
- console.log(`design-lenses: ${error}`);
- process.exit(1);
- }
- const p = join(root, OUT);
- if (!existsSync(p)) {
- console.log(`design-lenses: ${OUT} is missing. Run: shtuk run design-lenses build`);
- process.exit(1);
- }
- if (readFileSync(p, 'utf8') !== text) {
- console.log(`design-lenses: ${OUT} is stale. Run: shtuk run design-lenses build`);
- process.exit(1);
- }
- console.log(`design-lenses: ${OUT} is fresh`);