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

fix(ext/node): discover .npmrc in user's homedir #24021

Merged
merged 5 commits into from
Jun 26, 2024

Conversation

bartlomieju
Copy link
Member

This commit adds discovery of .npmrc files in user's homedir.

This is not a perfect fix as it doesn't merge multiple .npmrc files
together as per #23954
but allows to fallback if no .npmrc file is discovered in the project
root.

@marvinhagemeister
Copy link
Contributor

Should we also add support for the other locations? According to the docs there is a total of 4 locations to check:

The four relevant files are:

  • per-project config file (/path/to/my/project/.npmrc)
  • per-user config file (~/.npmrc)
  • global config file ($PREFIX/etc/npmrc)
  • npm builtin config file (/path/to/npm/npmrc)

@bartlomieju
Copy link
Member Author

Should we also add support for the other locations? According to the docs there is a total of 4 locations to check:

The four relevant files are:

  • per-project config file (/path/to/my/project/.npmrc)
  • per-user config file (~/.npmrc)
  • global config file ($PREFIX/etc/npmrc)
  • npm builtin config file (/path/to/npm/npmrc)

The last one makes no sense, because we're not npm and the "global" one has not been mentioned even once in #16105. I think we're fine with just per-project and per-user. Some tools like Renovate don't even support per-user config.

@marvinhagemeister
Copy link
Contributor

Fair point. Per project + per user probably covers 99% of use cases.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. LGTM

@bartlomieju bartlomieju merged commit 2a2ff96 into denoland:main Jun 26, 2024
17 checks passed
@bartlomieju bartlomieju deleted the npmrc_homedir branch June 26, 2024 22:17
sbmsr pushed a commit to sbmsr/deno-1 that referenced this pull request Jul 2, 2024
This commit adds discovery of `.npmrc` files in user's homedir.

This is not a perfect fix as it doesn't merge multiple `.npmrc` files
together as per denoland#23954
but allows to fallback if no `.npmrc` file is discovered in the project
root.
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
This commit adds discovery of `.npmrc` files in user's homedir.

This is not a perfect fix as it doesn't merge multiple `.npmrc` files
together as per denoland#23954
but allows to fallback if no `.npmrc` file is discovered in the project
root.
@okikio
Copy link

okikio commented Jul 12, 2024

Doesn't this potentially conflict with JSR?

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

Successfully merging this pull request may close these issues.

4 participants