Nx Workshop
← Back to lessons

Lesson 7Nx Create Your script

In this section, we will create a custom script that generates the code's documentation!

> npm run affected:lint
> npm run affected:build
> npm run affected -- --target=lint
> npm run affected -- --target=build
> npm run nx run hero-app:build
> npm i -D typedoc
> npx typedoc libs/hero/api-interfaces

workspace.json

...
"hero-api-interfaces": {
"root": "libs/hero/api-interfaces",
"sourceRoot": "libs/hero/api-interfaces/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/hero/api-interfaces/**/*.ts"
]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": [
"coverage/libs/hero/api-interfaces"
],
"options": {
"jestConfig": "libs/hero/api-interfaces/jest.config.js",
"passWithNoTests": true
}
},
"doc": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "npx typedoc libs/hero/api-interfaces --out docs/libs/hero/api-interfaces"
}
]
}
}
}
...
> npm run nx run hero-api-interfaces:doc
> npm run affected -- --target=doc