fix(docs): make the build self-contained for Vercel

Vercel's "Root Directory" setting limits the upload to docs/api/, so
the build cannot read sibling paths like ../../server/openapi.json or
../api-content/. A small prebuild script copies both into a vendored
folder inside the project tree (gitignored).

## Changes
- Add scripts/sync-sources.mjs to copy /docs/api-content/ and
  /server/openapi.json into docs/api/src/vendored/ before dev/build
- Wire predev/prebuild npm scripts so the sync runs automatically
- Update astro.config.mjs and src/content.config.ts to read from the
  vendored paths
- Gitignore src/vendored/ — contributors still edit the originals
This commit is contained in:
gorkem-bwl committed 2026-05-22 14:20:10 -04:00
1 parent 0d25973efb
commit 8e4e9dd87c
5 files changed
+72 -4

No files matched your search

+6 -3
View File
@@ -2,9 +2,12 @@ import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightOpenAPI, { openAPISidebarGroups } from "starlight-openapi";
// The OpenAPI spec lives in the server package. The Starlight integration
// reads it at build time and generates the full /api/reference/* tree.
const OPENAPI_PATH = "../../server/openapi.json";
// The OpenAPI spec is vendored from server/openapi.json by
// scripts/sync-sources.mjs (runs as predev/prebuild). We point at the
// vendored copy so the build is self-contained — Vercel only uploads
// the docs/api/ subtree, so paths outside this directory are not
// available at build time.
const OPENAPI_PATH = "./src/vendored/openapi.json";
export default defineConfig({
// Served at https://checkmate.so/docs — the leading slash is included so