nx icon indicating copy to clipboard operation
nx copied to clipboard

feat(core): add support for tags with `(print-)affected(:*)` and `run-many`

Open fguitton opened this issue 2 years ago • 10 comments

Current Behavior

When running the (print-)affected(:*) command you get all affected projects for a target. With the run-many command filtering is only possible with --projects. Both accept a --all, it being warned for in affected.

Expected Behavior

We would expect to be able to select projects by tags.

This PR

This could be seen as a first step only acting to select projects in the same way --projects does it for run-many. Tags are not applied in compound but rather as OR statement in comma separated fashion.

That is in the example below the command would select projects that either contain the tag sdk or the tag app, not necessarily projects containing both tags.

nx affected --tags=sdk,app --target=test

Related Issue(s)

This relates to very long standing #1621, #2675 or #8292 and a Nx v14 compatible treatment while being different from #8364 which attempts to support globs but does not address run-many.

Closes #1621 Closes #2675

fguitton avatar May 01 '22 13:05 fguitton

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Nov 5, 2022 at 4:00PM (UTC)

vercel[bot] avatar May 01 '22 13:05 vercel[bot]

Hello @vsavkin ! I know you had interest in looking at this over the past few years. It is the second PR opened for this feature but it addressed things slightly differently. I am happy to bring any changes required, any feedback/direction is most welcome We have a lot of need for this in our company.

Thank you for your help and valuable time 🙏🏼 !

fguitton avatar May 01 '22 13:05 fguitton

Any update on this? I would love to use it 😁 Also, I thought it might be worth adding this to print-affected as well

gioragutt avatar May 16 '22 18:05 gioragutt

I thought it might be worth adding this to print-affected as well

Hello ! The print-affected command should already work out of the box with the changes proposed at it is considered a special branch of the affected command and the project filtering gets done upstream of that.

https://github.com/nrwl/nx/blob/7f5137da84e5d0f1b31f9011c57fc0e3bfaa9252/packages/nx/src/command-line/affected.ts#L37

https://github.com/nrwl/nx/blob/7f5137da84e5d0f1b31f9011c57fc0e3bfaa9252/packages/nx/src/command-line/affected.ts#L79-L113

I can imagine there is latent question with regard to the use/semantic of --exclude which only applies to project names. I do not necessarily have a set opinion on this. In effect a tag filtering can very much replace the use of --exclude.

fguitton avatar May 17 '22 08:05 fguitton

Would love to see this merged into Nx and my PR closed.

yharaskrik avatar May 24 '22 14:05 yharaskrik

This would be a big QoL feature for us, would love to see this in the next release! Any indications when that might be?

epechuzal avatar Jun 24 '22 22:06 epechuzal

Can't wait for this to be merged :smile:

sylvainar avatar Jun 30 '22 08:06 sylvainar

pls

josh-stevens avatar Jul 29 '22 16:07 josh-stevens

This would be a great QoL feature for our team 👍

starch avatar Jul 29 '22 16:07 starch

@gioragutt

jon9090 avatar Oct 15 '22 05:10 jon9090

@gioragutt

Can you add some context to why you tagged me? 😅

gioragutt avatar Oct 15 '22 07:10 gioragutt

My team and I are so excited about this feature please release it in next version :)

jon9090 avatar Oct 31 '22 15:10 jon9090