mirror of
https://github.com/andrewyng/openworker.git
synced 2026-11-04 21:37:21 +00:00
/#/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.
13 lines
581 B
TypeScript
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");
|
|
});
|