Guides

Installation

Node.js versions

Compodoc is tested with only LTS versions : v10.x, v8.x ; and support also Node.js v10.x+

Angular-CLI

Compodoc supports last Angular-CLI version : 10.x

Just run Compodoc in a fresh or existing project.

Global installation

Install from npm :

npm install -g @compodoc/compodoc

If you use PowerShell on Windows, add quotes :

npm install -g "@compodoc/compodoc"

Local installation

npm install --save-dev @compodoc/compodoc

Run

Create a file named tsconfig.doc.json, containing a key include pointing to src folder, you can also use exclude key :

{
  "include": ["src/**/*.ts"],
  "exclude": ["src/test.ts", "src/**/*.spec.ts", "src/app/file-to-exclude.ts"]
}

Define a script task for it in your package.json (with npm 6.x) :

"scripts": {
  "compodoc": "npx compodoc -p tsconfig.doc.json"
}

and run it like a normal npm script :

npm run compodoc

or with npx :

npx @compodoc/compodoc ...

See usage for more details.

Position of tsconfig file in codebase

Compodoc start at the folder level of the tsconfig file provided with -p option.

Example for an Angular CLI project :

.
├── src
│ ├── app
│ │ ├── app.component.ts
│ │ └── app.module.ts
│ ├── main.ts
│ └── ...
├── tsconfig.app.json
├── tsconfig.doc.json
└── tsconfig.json