Allow to run "nx affected" with BOTH untracked=true and uncommitted=true #22085
Replies: 2 comments
-
I don't think this is necessary, as you can |
Beta Was this translation helpful? Give feedback.
-
I think this would reflect the command much better as it looks. If I am able to pass both It doesn't seem to be documented as to what the intended behavior is anyway. The options in the Nx docs wherever I can find them (the official Nx docs search showed me more results at first when I searched |
Beta Was this translation helpful? Give feedback.
-
Description
run the affected command with both
untracked=true
anduncommited=true
at the same time:nx affected --target=some-target --untracked==true --uncommitted=true
Motivation
If a developer works on a new library in a big project he might want to run tasks like tests, linting, typechecking before committing anything. Even though the commit history might not represent the real history of how someone has worked on the code (however chaotic it may be) it might be a good feature to be able to run targets for all "changed" and "new" files.
Currently you cannot run
affected
with bothuntracked=true
anduncommitted=true
Suggested Implementation
Keep both parameters
untracked
anduncommitted
keep working as before, but you could use them also combined.According to the code https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/command-line-utils.ts#L247 this happens only if the
head
option is not set and thebase
option is set (don't understand why though). So we extend to logic in https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/command-line-utils.ts#L247-L254 by addingbefore L247..
Alternate Implementations
I'm not aware of other ways to do it.
On the second thought:
If the command is executed often and the results are cachable then I could just run
nx run-many --target=someTarget --parallel=3
and basically get the same effect? I hope some NX specialist can help me solve this very tiny riddle :-)But if the command is only executed from time to time locally (i.e. e2e tests) then my proposal could still make sense.
Beta Was this translation helpful? Give feedback.
All reactions