Skip to content

Maintaining these docs ​

Author guides in docs/. Put focused usage snippets in tools/docs/snippets and include it using VitePress snippet imports. Keep synthetic input and browser harnesses under tools/docs/tests/fixtures; do not copy application project files. Generated docs/api-reference/ pages are ignored by git; edit public TypeScript documentation comments instead.

Commands ​

sh
npm run docs:dev
npm run docs:api
npm run docs:build
npm run docs:test

docs:test builds the site, checks example types and behavior, checks internal links and anchors, runs browser coverage, and installs the package tarball into a temporary consumer. It requires Chromium (npx playwright install chromium) and access to npm for the independent consumer's external dependencies. It runs using Node and Chromium.

The API manifest in tools/docs/api-entries.mjs must account for every package export, including non-TypeScript assets. Source signatures are generated with TypeDoc and typedoc-plugin-markdown. The docs workspace owns these build dependencies only.

Static hosting ​

The build outputs docs/dist. Serve that directory with any static file server; no application server is required. Routes use .html, including direct page reloads. The homepage lives at /; the overview and all guides, API pages, and examples live under /docs/. VitePress rewrites docs/overview.md to /docs/index.html while keeping docs/index.md as the homepage. For a subdirectory deployment, set a leading/trailing-slash base:

sh
DOCS_BASE=/grabm/ npm run docs:build
DOCS_BASE=/grabm/ npm run test -w @grabm/docs

The default base is /. Hosting credentials and package release workflows remain separate from this build.

Vercel ​

The root vercel.json builds with npm run docs:build and serves only docs/dist. The interactive demo executes in a browser worker; no backend service, Docker container, or serverless function is deployed. The backend guide remains documentation for running the optional example locally.

To redeploy from a checkout linked to the Vercel project:

sh
npx vercel pull --yes --environment=production
npx vercel build --prod
npx vercel deploy --prebuilt --prod

The prebuilt workflow uploads the generated static output. .vercel/ contains local project configuration and build output and is ignored by Git. Keep .html routes and the root base path when deploying this site.

Themes and checks ​

The site uses VitePress 1.6.4's default theme and native light/dark toggle. The CSS-only @nikodellic/publisher-docs package supplies shared formatting from tools/docs/vendor/. Its source and starter live in the sibling publisher-docs repository. Update the archive and lockfile together across the three library sites.

Documentation uses VitePress color variables and has no palette selector. Embedded examples keep their semantic colors in docs/.vitepress/theme/example-tokens.css and respond to grabm:themechange for canvas and WebGL updates. The library's exported application themes remain independent and unchanged. Browser checks cover both appearances, readable controls, search, code, mobile navigation, and renderers.

Code highlighting ​

Use a language tag on each code fence (ts, js, json, or sh); snippet imports inherit their source file's language. Reserve text for literal output or explanatory formulas that are not programming languages. Generated API examples use the same VitePress highlighting pipeline.

Documentation uses Shiki's built-in GitHub high-contrast light/dark themes through standard VitePress configuration. The embedded JSON viewer owns its separate highlighter in examples/shared/. Browser checks verify distinct syntax colors and at least 4.5:1 contrast for rendered token colors in both appearances.

Documentation for the grABM library.