API reference docs are generated with TypeDoc (v0.28) from TSDoc comments in the source code. The output lives in website/public/api-docs/ and is served as static files by the Next.js website.
website/public/api-docs/
index.html ← version picker page (committed)
versions.json ← version manifest (committed)
latest/ ← always regenerated, gitignored
v1.1.10/ ← committed snapshot
v1.2.0/ ← committed snapshot (example)
| Command | Purpose |
|---|---|
npm run docs |
Generate latest docs + inject GTM |
npm run docs:snapshot |
Snapshot latest → v{version}/, update picker |
VERSION=1.2.3 npm run docs:snapshot |
Snapshot with explicit version |
npm run docsThis runs TypeDoc → website/public/api-docs/latest/, then scripts/inject-gtm.sh adds Google Tag Manager to all HTML files. The latest/ directory is gitignored and always regenerated fresh.
After bumping the version in root package.json:
npm run docs # regenerate latest
npm run docs:snapshot # copies latest/ → v{version}/, updates picker
git add website/public/api-docs/
git commit -m "docs: snapshot v1.2.0 API reference"The snapshot script:
- Copies
latest/→v{version}/ - Rebuilds
versions.jsonfrom existingv*/directories - Regenerates
index.html(version picker page with GTM) - Refuses to overwrite an existing snapshot (delete first if intentional)
If a past version had fewer packages (e.g., v1.1.10 had no mapper/react-form), generate it with a custom config:
npx typedoc --options typedoc.custom.json
./scripts/inject-gtm.sh website/public/api-docs/v1.1.10| File | Role |
|---|---|
typedoc.json |
Root TypeDoc config: entry points, output dir, nav links |
libs/*/typedoc.json |
Per-package TypeDoc config (entry points, excludePrivate) |
scripts/inject-gtm.sh |
Injects GTM-WRLXDMG into all HTML files in a directory |
scripts/snapshot-docs.sh |
Snapshots latest docs as a versioned release |
.gitignore |
Ignores website/public/api-docs/latest only |
- TSDoc comments in source → TypeDoc reads them
- TypeDoc generates static HTML into
website/public/api-docs/latest/ - inject-gtm.sh adds GTM tracking to every HTML page (idempotent, skips already-injected files)
- Next.js serves
public/api-docs/as static files - next.config.ts has redirects:
/api-docs→/api-docs/index.html,/api-docs/latest→/api-docs/latest/index.html - Navbar links to
/api-docs(the version picker) - TypeDoc header has "← Back to Website" and "All Versions" nav links
- Create
libs/newlib/typedoc.json:{ "$schema": "https://typedoc.org/schema.json", "entryPoints": ["src/index.ts"], "excludePrivate": true } - Add
"libs/newlib"to theentryPointsarray in roottypedoc.json - Run
npm run docsto verify
The website/Dockerfile handles docs generation in the build stage:
- Copies
scripts/,typedoc.json, and alllibs/ - Installs
perlandbash(needed by inject-gtm.sh on Alpine) - Runs
npm run docsto generate latest docs - Committed versioned snapshots (
v*/) come in via the website COPY step
All API docs pages include Google Tag Manager (GTM-WRLXDMG). The inject-gtm.sh script adds:
- Head snippet: GTM loader script before
</head> - Body snippet:
<noscript>iframe after<body>
The script is idempotent — safe to run multiple times on the same directory. To use a different GTM ID:
./scripts/inject-gtm.sh website/public/api-docs/latest CUSTOM-GTM-ID