Generating CompoDoc for an Angular Library Project | Task

Ole Ersoy
Jan - 09  -  1 min

Scenario

We have created a test library within our Angular workspace.

ng g library test

Now we wish to generate Compodoc documentation for the library.

Approach

Install Compodoc.

npm install -g @compodoc/compodoc

Create tsconfig.doc.json in the root folder with the following contents.

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

Generate the documentation.

npm run compodoc

Serve the documentation.

compodoc -so