nx:run-commands
Run any custom commands with Nx.
Options can be configured in project.json when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
project.json:
{
// ...
"targets": {
//...
"ls-project-root": {
"executor": "nx:run-commands",
"options": {
"command": "ls apps/frontend/src"
}
}
}
}
nx run frontend:ls-project-root
Examples
The commands option accepts as many commands as you want. By default, they all run in parallel. You can run them sequentially by setting parallel: false:
"create-script": {
"executor": "nx:run-commands",
"options": {
"commands": [
"mkdir -p apps/frontend/scripts",
"touch apps/frontend/scripts/my-script.sh",
"chmod +x apps/frontend/scripts/my-script.sh"
],
"parallel": false
}
}