sonda/web/scripts/gen-api.mjs
tgiachi f1da4b5aaf feat(web): scaffold the React app with Vite, Tailwind and shadcn/ui
- Vite, React 19 and TypeScript in web/, Vitest with jsdom and Testing Library
- Tailwind v4 and shadcn/ui, with Figtree and Fraunces bundled locally
- npm run gen:api builds src/api/schema.d.ts from the OpenAPI spec
- dev server proxies /api to sondad (SONDA_URL, default 127.0.0.1:8080)
- mockFetch test helper that refuses unmatched requests
2026-11-12 11:15:50 +01:00

13 lines
547 B
JavaScript

// Regenerates src/api/schema.d.ts from the API spec in the Go module.
// openapi-typescript is run through npx because it still asks for TypeScript 5 as a peer.
import { execFileSync } from 'node:child_process'
import { fileURLToPath } from 'node:url'
const root = fileURLToPath(new URL('..', import.meta.url))
const spec = fileURLToPath(new URL('../../internal/api/openapi/openapi.yaml', import.meta.url))
execFileSync(
'npx',
['--yes', 'openapi-typescript@7.13.0', spec, '-o', 'src/api/schema.d.ts'],
{ cwd: root, stdio: 'inherit' },
)