rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] Add syntax for multiple package installation in one script

Open Jabher opened this issue 5 years ago • 7 comments
trafficstars

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

Jabher avatar Jan 15 '20 13:01 Jabher

@iclanton - Can you take a look?

rakeshpatnaik avatar Jan 15 '20 18:01 rakeshpatnaik

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.

trusktr avatar Jan 27 '20 07:01 trusktr

I think rush add is more or less mirroring of yarn add command.

Jabher avatar Feb 03 '20 16:02 Jabher

Naïve first take on how to do this would be to:

  1. Switch _packageName on AddAction to string list parameter (https://github.com/microsoft/rushstack/blob/master/apps/rush-lib/src/cli/actions/AddAction.ts#L48)
  2. Build a list of configs for each package (apply same settings to each of them)
  3. 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?

christopheranderson avatar Mar 11 '21 22:03 christopheranderson

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

smolinari avatar Oct 07 '21 13:10 smolinari

Is there any progress on this issue?

ericlee33 avatar Jul 20 '22 03:07 ericlee33

rush add -p package1 -p package2 -p package3

ms-rvandeneykel avatar Jul 20 '22 23:07 ms-rvandeneykel

Closing - now available in Rush by specifying the -p flag multiple times, as in the comment above!

elliot-nelson avatar Dec 22 '22 05:12 elliot-nelson

Cool! Thanks for adding this feature! Rush for the Win! :grin: :+1:

Scott

smolinari avatar Dec 22 '22 07:12 smolinari