Skip to content

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

Merged
bartlomieju merged 5 commits into
denoland:mainfrom
bartlomieju:npmrc_homedir
Jun 26, 2024
Merged

bartlomieju merged 5 commits into
denoland:mainfrom
bartlomieju:npmrc_homedir

Conversation

@bartlomieju

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

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

@dsherret dsherret left a comment

Copy link
Copy Markdown
Contributor

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
@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

okikio commented Jul 12, 2024

Copy link
Copy Markdown

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