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

[Bug]: Different behavior for $HOME npmrc file with pnpm and rules_js #2019

Open
scttdavs opened this issue Nov 14, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@scttdavs
Copy link

What happened?

Rules_js allows you to use your home npmrc file in addition to the project one via npm_translate_lock and the npmrc and use_home_npmrc fields. The contents of the home npmrc file will override any conflicting settings in the project file. This is great and allows us to specify our auth tokens in the project file via environment variables to work in our CI, but still use the home npmrc locally with user-specific auth credentials.

However, when using pnpm locally, it does the opposite, it overrides the home npmrc file with the project file's settings. These behaviors should be consistent for getting a solution for both local development and CIs to work.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 6.5.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: WORKSPACE

Language(s) and/or frameworks involved: JavaScript

How to reproduce

I think any sample project where local auth tokens are specified in the home npmrc, and in the project npmrc they are specified via env variables. Bazel tasks will install and complete just fine, however local pnpm commands to add/install will fail with "Failed to replace env in config: ${NPM_TOKEN}".

Any other information?

The real issue we're trying to solve is how to have a local npmrc with auth for development that is not checked into source control, while defining environment variables for auth in our CI. If there is a recommended path for this, we'd love to know what it is, if not, creating a path for this would be ideal.

@scttdavs scttdavs added the bug Something isn't working label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant