benjivers/notes Public Public: anyone can read this; nobody can change it.

Files 2b2f00dc243e6583e6d8719a8b99fe2335f1e03a
14 lines · 543 B · ~156 tok Raw History
1
/**
2
 * Write the API's description where git keeps it: contract/openapi.json,
3
 * from the routes' own `api` entries (src/openapi.ts). Run it after
4
 * changing a route or a cell of contract.json; the tests say when it is due.
5
 */
6
7
import { mkdirSync, writeFileSync } from "node:fs";
8
import { join } from "node:path";
9
import { emit } from "../src/openapi.ts";
10
11
const dir = join(import.meta.dir, "..", "contract");
12
mkdirSync(dir, { recursive: true });
13
writeFileSync(join(dir, "openapi.json"), emit());
14
console.log("wrote contract/openapi.json");
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts