Skip to content
compodocx
Skip to article content

Guide 02

Getting Started

cngxjs (opens in new tab) Updated Guide 02 of 13

A working compodocx setup is three things: the package, a tsconfig that points at your Angular (opens in new tab) source, and an output location. Defaults handle the rest. Requires Node (opens in new tab) 22 or newer.

bash
npm install --save-dev @cngxjs/compodocx
npx compodocx -p tsconfig.doc.json

The default output goes to ./documentation/<versionLabel>/.
Multi-version layout is on by default. versionLabel is auto-detected from the nearest package.json.
Pass --no-multiVersion for the flat single-version layout.

Add --watch --serve while authoring to get a local dev server with live reload.

A minimal tsconfig

compodocx uses TypeScript’s own resolver. A doc-specific tsconfig keeps test files, storybook, and dev-only entries out of the rendered API surface.

json tsconfig.doc.json
{
  "extends": "./tsconfig.json",
  "include": ["src/**/*.ts"],
  "exclude": ["**/*.spec.ts", "**/*.stories.ts"]
}

Coming from compodoc

Most flags carry over. Two breaking changes worth knowing up front: the package is now @cngxjs/compodocx, and the output is multi-version by default. Pin a label or pass --no-multiVersion if your CI publishes to a flat folder. Custom Handlebars templates need a one-time port via compodocx migrate templates.