Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have Rush add dev dependencies to new project

Tags:

rush

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.

like image 489
kierans Avatar asked Dec 05 '25 18:12

kierans


2 Answers

(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

like image 122
toni Avatar answered Dec 09 '25 01:12

toni


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:

  • setting preferredVersions in the common-versions.json file
  • using a version policy such as lockStepVersion
like image 31
wes Avatar answered Dec 09 '25 01:12

wes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!