ShtukbaseStandard
archivo del paquete→ .shtukbase/packages/design-lenses/actions/check.ts

actions/check.ts

21 líneas, 743 B.

El archivo tal como está en el paquete: el código y sus comentarios no se traducen.

  1. // Action `check`: exit 1 when lib/design/style.data.js is missing or does not match the chosen style.
  2. import { existsSync, readFileSync } from 'node:fs';
  3. import { join } from 'node:path';
  4. import { OUT, expectedText } from '../lib/project.ts';
  5. const root = process.cwd();
  6. const { text, error } = expectedText(root);
  7. if (!text) {
  8. console.log(`design-lenses: ${error}`);
  9. process.exit(1);
  10. }
  11. const p = join(root, OUT);
  12. if (!existsSync(p)) {
  13. console.log(`design-lenses: ${OUT} is missing. Run: shtuk run design-lenses build`);
  14. process.exit(1);
  15. }
  16. if (readFileSync(p, 'utf8') !== text) {
  17. console.log(`design-lenses: ${OUT} is stale. Run: shtuk run design-lenses build`);
  18. process.exit(1);
  19. }
  20. console.log(`design-lenses: ${OUT} is fresh`);