Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kenrick95 opened this issue May 23, 2024 · 2 comments

Comments

@kenrick95
Copy link
Contributor

kenrick95 commented May 23, 2024

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

  • One workspace project that has react-router@^5 as dependency. react is a peer dependency. react is not installed. (link to lockfile)

  • One autoinstaller that has react-router@^5 as dependency. react is a peer dependency. react is installed. (link to lockfile)

    Expected result: the auto-install-peers config in autoinstaller should inherit from pnpm-config.json? If not, there should be other way to set this config only for the autoinstaller. At point of writing, it is not possible to

    Actual result: the auto-install-peers config in autoinstaller uses the pnpm's global default config

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
Copy link
Member

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
Copy link
Contributor Author

Sure thing!

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

  • When autoinstaller command is executed, it will sync .npmrc-autoinstaller to the autoinstaller folder.
  • If .npmrc-autoinstaller doesn't exist, then it will use common/config/rush/.npmrc. This is the existing behavior.

How does that sound?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Low priority
Development

No branches or pull requests

2 participants