3

When adding a new project to a Rush monorepo, is there a way for Rush to automatically insert the dev dependencies into the package.json? For example I want to use the same test frameworks between projects so it would be good to have Rush sync the dev dependencies.

kierans
  • 2,034
  • 1
  • 16
  • 43

2 Answers2

2

(I presume you found this answer already but in case any stumbles across this in the future)

If you run rush add -h you get the usage. [usage: rush add [-h] -p PACKAGE [--exact] [--caret] [--dev] [-m] [-s] [--all]]

--dev If specified, the package will be added to the "devDependencies" section of the package.json

The command you are looking for is

rush add -p PACKAGENAME --dev

toni
  • 21
  • 3
  • Thanks, but I'm wanting Rush to `automatically insert the dev dependencies`. If I have to add the packages myself then that's not the solution I'm after. – kierans May 30 '21 at 06:07
1

No, there is no way to do this. rush has no idea which package requires which dependencies and, as such, you'll need to add them manually to each.

However, once you've configured your package.json's accordingly, rush will help you maintain dependency versioning across your monorepo. The precise behaviour can be configured by:

wes
  • 734
  • 6
  • 14