Files
openworker/surfaces/gui/scripts/gallery-contract.write.test.ts
Rohit C Prasad 2be346d7dd Card gallery (dev only): card states, scenario sessions, server contract check
/#/gallery renders every card state from payload files; scenario sessions boot the real app from JSON.
A contract file keeps the states in step with what the server sends. Not in the production bundle.
2026-09-18 11:54:30 -07:00

13 lines
581 B
TypeScript

// Writer for src/gallery/states.contract.json. A vitest file so it can import the TypeScript
// state files directly; it does nothing unless asked: npm run gallery:contract
import { writeFileSync } from "node:fs";
import path from "node:path";
import { it } from "vitest";
import { buildContract } from "../src/gallery/contract";
it.skipIf(process.env.UPDATE_CONTRACT !== "1")("writes states.contract.json", () => {
const file = path.join(__dirname, "..", "src", "gallery", "states.contract.json");
writeFileSync(file, JSON.stringify(buildContract(), null, 2) + "\n");
});