microsoft / rushstack

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

[rush] Autoinstaller doesn't get the auto-install-peers config from pnpm-config.json #4733

Open kenrick95 opened 1 month ago

kenrick95 commented 1 month ago

Summary

When updating autoinstaller's lockfile, the PNPM auto-install-peers config isn't inherited from pnpm-config.json. It seems like it is using the PNPM's default value, in which in PNPM 8, it defaults to auto-install-peers = true.

One workaround is to edit common/config/rush/.npmrc to add the line that says auto-install-peers = false. However this will emit warning when running rush install/rush update:

Warning: PNPM's auto-install-peers is specified in both .npmrc and pnpm-config.json. The value in pnpm-config.json will take precedence.

If it is not meant to inherit the config from pnpm-config.json, there should be other way to set this config only for the autoinstaller. At point of writing, it is not possible to create a .npmrc only for autoinstaller as Rush will sync the common/config/rush/.npmrc to the autoinstaller's .npmrc

Repro steps

Repro repo: https://github.com/kenrick95/rush-repro-autoinstaller-autoinstallpeers

Details

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.117.8
rushVersion from rush.json? 5.124.7
useWorkspaces from rush.json? Yes
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 18.20.2
iclanton commented 1 month ago

The easiest way to handle this is to probably create a .npmrc specifically for autoinstallers. @kenrick95 - Would you be interested in putting together that change?

kenrick95 commented 1 month ago

Sure thing!

To approach this, I'm thinking of having an optional .npmrc-autoinstaller in common/config/rush/, which works like .npmrc-publish.

How does that sound?