benjivers/notes Public Public: anyone can read this; nobody can change it.
Files 1060c95de59213030a45f268d791921201715cde
| 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"); |