Nx comes with dedicated documentation for each framework:

Running Custom Commands

Compodoc is a great tool for automatically generating documentation for Angular projects. In order to use it, you need to run a simple command in the terminal.

This recipe will show how to run any terminal command within the nx build-chain using Compodoc as an example.

Steps

1. Define the terminal command to be run

The command we want to run for each project is:

compodoc -p [path/to/tsconfig.json]
2. Update angular.json

For each project for which you want to enable compodoc, add a target in angular.json:

1// ...
2"my-app": {
3    "architect": {
4        "compodoc": {
5            "builder": "@nrwl/workspace:run-commands",
6                "options": {
7                "commands": [
8                    {
9                        "command": "npx compodoc -p apps/my-app/tsconfig.app.json"
10                    }
11                ]
12            }
13        }
14        // ...
15    }
16}

For more information, see the run-commands api doc.

Note: Replace apps/my-app/tsconfig.app.json with the appropriate tsconfig.json path for each project.

3. Trigger the builder from the terminal

To run the builder for a single project:

nx run my-app:compodoc

To run the builder for all affected projects:

nx affected --target=compodoc

For more information, see the nx affected.