I have a mixed repo with some non-JS projects that use make
for running tasks. I am integrating these into an Nx monorepo by simply defining the tasks in each project.json
using the generic nx:run-commands
executor.
The problem is, if I use the convenient short form:
"targets": {
"test": {
"command": "make test"
}
}
The target is run from the workspace root and make is unable to locate the Makefile. I can solve this using the long form and setting the cwd
option:
"targets": {
"test": {
"executor": "nx:run-commands",
"options": {
"command": "make test",
"cwd": "apps/myapp"
}
}
}
Of course, this will become highly repetitive and bloated as I need to do this for every target in every project.
Is there a way to set default options at the project level? It seems that the targetDefaults
attribute is only available in the workspace nx.json
, which will not work since each project needs a different cwd
.
Alternatively, is there a way to configure the run-commands
executor to have the project root as the default cwd?