rushstack
rushstack copied to clipboard
[rush] Add syntax for multiple package installation in one script
Please prefix the issue title with the project name i.e. [rush], [api-extractor] etc.
Is this a feature or a bug?
- [x] Feature
What is the expected behavior? All of package managers allow to do something like
npm install eslint eslint-plugin-node eslint-plugin-react eslint-preset-airbnb...
However, rush forces user to install every package separately, and also running rush update every time rush add is executed (if -s flag is not passed).
It is worse experience in comparison to common package managers.
Maybe, rush will support shorthand syntax for adding multiple packages at a time?
E.g. rush add package1 package2 package3
@iclanton - Can you take a look?
Why not just mirror the npm install command, so
rush install one two three etc
?
Speaking of mirroring the npm commands (to some extent), perhaps a rush link some-package similar to npm link some-package would be helpful too, and it would link to the local project some-package. This may be useful for #1721.
I think rush add is more or less mirroring of yarn add command.
Naïve first take on how to do this would be to:
- Switch _packageName on AddAction to string list parameter (https://github.com/microsoft/rushstack/blob/master/apps/rush-lib/src/cli/actions/AddAction.ts#L48)
- Build a list of configs for each package (apply same settings to each of them)
- Call doRushAdd() for each package with skipInstall set on all but the last one
It might be better to push this handling down into doRushAdd as well, but I haven't looked through the code enough to know if that'd have side effects to understand. That is theoretically better because it would avoid updating the package.json N times.
In theory, should also be simple to add ...rest support similar to how other tools work, rather than relying on explicit -p flags.
@iclanton - would this issue be something you'd be open to contributions on?
Any progress on this? I'm liking Rush, but I just ran into wanting to install three or four deps and having to rerun the add command for each one. Not really fun.
Scott
Is there any progress on this issue?
rush add -p package1 -p package2 -p package3
Closing - now available in Rush by specifying the -p flag multiple times, as in the comment above!
Cool! Thanks for adding this feature! Rush for the Win! :grin: :+1:
Scott