Allow an affected target to run only on directly modified projects without walking the dependency graph #22566
Replies: 4 comments 7 replies
-
For lint in particular, it's generally not the slowest part of the pipeline so it's less important. If the lint tasks do not have any inputs which start with If we were to add something we would need to design it out further. |
Beta Was this translation helpful? Give feedback.
-
Same issue here 👋🏼 |
Beta Was this translation helpful? Give feedback.
-
What we did is basically a small node script that does git diff to take files and then we use nx affected with --files flag. Works like a charm. I still think it's something that nx affected should be doing out of the box. |
Beta Was this translation helpful? Give feedback.
-
for precommit checks were doing something like this: |
Beta Was this translation helpful? Give feedback.
-
Description
I would like to execute a target on all directly affected projects in the nx workspace. My usecase is specifically for linting, but could be usefull for formatting or docs generation as well.
Motivation
For linting I would like to run the target only on directly affected projects, unlike unit tests or e2e tests, reducing the amount of time required to run
nx affected -t lint
. For linting it doesn't make sense to walk the dependency trying to executing the same target on other projects that depend on the directly modified project.Suggested Implementation
For the
nx affected
command implement a --direct or --depth option.Please let me know if you would welcome a PR.
Beta Was this translation helpful? Give feedback.
All reactions