nx/docs/shared/recipes/use-executor-configurations.md
2022-11-03 14:39:47 -04:00

39 lines
1.0 KiB
Markdown

# Use Executor Configurations
The `configurations` property provides extra sets of values that will be merged into the options map.
```json {% fileName="project.json" %}
{
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{workspaceRoot}/dist/libs/mylib"],
"dependsOn": ["^build"],
"options": {
"tsConfig": "libs/mylib/tsconfig.lib.json",
"main": "libs/mylib/src/main.ts"
},
"configurations": {
"production": {
"tsConfig": "libs/mylib/tsconfig-prod.lib.json"
}
}
}
}
```
You can select a configuration like this: `nx build mylib --configuration=production`
or `nx run mylib:build:configuration=production`.
The following code snippet shows how the executor options get constructed:
```javascript
require(`@nrwl/jest`).executors['jest']({
...options,
...selectedConfiguration,
...commandLineArgs,
}); // Pseudocode
```
The selected configuration adds/overrides the default options, and the provided command line args add/override the
configuration options.