nx
nx copied to clipboard
Add Ignore dependencies CLI option
- [ ] I'd be willing to implement this feature (contributing guide)
Description
Currently, when you run an Nx command, like build
or any other custom target that has the following configuration:
{
...
"targets": {
"mytask": {
"executor": "nx:run-commands",
"options": {
"command": "do something"
},
"dependsOn": ["build"]
}
}
...
}
There is no way to ignore the dependsOn
Motivation
Sometimes we don't need to run the entire dependency tree when we are testing something, or doing something repetitively, of course, I can have a second target for the same task with the same configuration, but it is not ideal, because you need to maintain 2 versions of the same thing.
Suggested Implementation
Have a CLI option --ignore-dependencies
or --no-deps
(personally like --no-deps
more) and when the option is detected ignore all the task dependencies.
nx run <project>:mytask --ignore-dependencies
Or
nx run <project>:mytask --no-deps
In this way, the default always runs the entire dependency graph for the task, but if the developer provides the CLI option, Nx bypasses them.
Alternate Implementations
+1 This would be very practical and save some work making redundant task definitions
We've recently bumped into that case and while completely ignoring dependencies is some solution, but in Gradle (a build tool originally for Java/JVM), there is also a switch to disable/ignore just particular test, e.g.
nx run <project>:mytask --ignore-dependencies build2
That would ignore the dependent build2
task, but assuming there were both build1
and build2
provided as dependencies, build1
would still be executed.
Maybe that variant could also be available (together with the "total" dependencies ignoring)?
Same here. I need to trigger tasks individually without triggering the whole chain of tasks.
Same pb for me. I have to duplicate tasks to add a variant without dependencies just to skip the chain.
Any news about this issue?? +1
+1 do we have any update on this ?
+1. With a large repo with lot of projects, running all of the task dependencies takes a lot of time, even when they are cached. Would like to be able to just execute the test task without running the dependent tasks. We build all our code upfront beforehand, as this is much faster than letting nx build everything.
Any news about this issue?? 👋
Any news about this issue?? +1
+1
+1
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.