Skip to content
compodocx
Skip to article content

Guide 03

Usage

cngxjs (opens in new tab)Updated Guide03of 13

A few patterns we lean on. Most flags have a config-file equivalent.

Build once for CI

bash
npx compodocx -p tsconfig.doc.json

Writes to ./documentation/<versionLabel>/ by default. The label is read from the nearest package.json. Pass--no-multiVersion for a flat output.

Watch during authoring

bash
npx compodocx -p tsconfig.doc.json --watch --serve

The dev server reuses the same routing and theming as production. What you see locally matches what ships.

Multi-version with a custom label

bash
npx compodocx -p tsconfig.doc.json --versionLabel v1.4.0

Writes ./documentation/v1.4.0/ and updates./documentation/versions.json. The manifest is append-only, deduplicated by label, and semver-sorted descending. The version-switcher in the navbar reads it at runtime, no extra wiring.

Wire into npm scripts (opens in new tab)

jsonpackage.json
"docs": "compodocx -p tsconfig.doc.json",
"docs:watch": "compodocx -p tsconfig.doc.json --watch --serve",
"docs:json": "compodocx -p tsconfig.doc.json --exportFormat json -d snapshots/",
"docs:llm": "compodocx -p tsconfig.doc.json --exportFormat llm-md"

API diff between snapshots

bash
npx compodocx -p tsconfig.doc.json --exportFormat json -d snapshots/next/
npx compodocx diff --old snapshots/prev/documentation.json --new snapshots/next/documentation.json

Exits 0 on no public-API change,1 on additive changes, 2 on breaking changes (or fatal errors). Add --json or --md for a report your bot can post as a PR comment. Both exports must come from the same compodocx schema, so re-export older baselines after an upgrade.

Validate playgrounds in CI

bash
npx compodocx playground:validate documentation

Builds every @playground of a generated docs folder with a realnpm install and ng build. Exits1 when one fails. It needs network access and is slow, so run it as a CI step after the docs build.

LLM context for code review

bash
npx compodocx -p tsconfig.doc.json --exportFormat llm-md

Without -d, writes to stdout. Pipe it straight into your AI assistant or any tool that reads markdown. With -d, writes<output>/llm-context.md.