microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.81k stars 592 forks source link

[rush] add -o to `rush add` #3308

Open unional opened 2 years ago

unional commented 2 years ago

Summary

rush build and others support running against a particular package(s). It would be great if rush add can do the same.

Details

i.e. instead of:

# from one package to another
> cd ../../group-x/package-a
> rush add -p <dep>

it would be great if we can do this anywhere in the repo:

> rush add -p <dep> -o package-a

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.63.0
rushVersion from rush.json? 5.63.0
useWorkspaces from rush.json? false
Operating system? Windows
Would you consider contributing a PR? Yes
Node.js version (node -v)? 16.14.2
iclanton commented 2 years ago

Would you want the full selection logic here (--to, --from, etc), or just --only?

Would it make more sense to call this parameter --project or something similar that implies that you're specifying the project you want to add the dependency to?

unional commented 2 years ago

Since rush add is about adding dependencies, it doesn't seems like --to and --from would be very useful.

IMO, the use cases are typically --only, like rush add "lodash to package-a", or all or selected set rush add "react to all ui packages", or rush add "jest to all packages".

Of course, there might be other use cases that I haven't think of.

pnpm has --filter which you can select one or more packages, which would like be more flexible, but doesn't fit with the current design of rush.