Skip to content

fix(manager/npm): search for npmrc in the root directory#36050

Merged
rarkins merged 5 commits intorenovatebot:mainfrom
lpriyasivakumar:fix/npmrc-check
May 29, 2025
Merged

fix(manager/npm): search for npmrc in the root directory#36050
rarkins merged 5 commits intorenovatebot:mainfrom
lpriyasivakumar:fix/npmrc-check

Conversation

@lpriyasivakumar
Copy link
Copy Markdown
Contributor

Changes

The .npmrc file was searched for as a sibling of a package file. With this change, .npmrc will be detected and applied if it is at the root of the repository. This is how pnpm reads the .npmrc file in mono repos.
Clarified by pnpm contributors here

Context

We currently have teams that have a nested mono-repo structure. In these repos, renovate does not correctly use our internal registry url to fetch internal and scoped packages. The bug is described with reproduction and logs in this discussion thread.
#35926

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@lpriyasivakumar
Copy link
Copy Markdown
Contributor Author

lpriyasivakumar commented May 20, 2025

@rarkins Raised the PR again as requested. Would love to know how I can improve the fix without breaking functionality. Ty!

@lpriyasivakumar lpriyasivakumar changed the title search for npmrc up the directory tree fix(manager/npm): search for npmrc in the root directory May 20, 2025
@rarkins
Copy link
Copy Markdown
Contributor

rarkins commented May 21, 2025

One thing we need to fix is that Renovate should not write out to disk the workspace .npmrc file to all workspaces

@rarkins rarkins requested a review from viceice May 22, 2025 07:54
Copy link
Copy Markdown
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

otherwise lgtm

Comment thread lib/modules/manager/npm/utils.ts
@rarkins rarkins requested a review from viceice May 23, 2025 12:01
@rarkins rarkins enabled auto-merge May 24, 2025 08:57
@lpriyasivakumar
Copy link
Copy Markdown
Contributor Author

@rarkins @viceice Do we have a timeline of when this PR will be reviewed/merged? Thank you!

@rarkins rarkins added this pull request to the merge queue May 29, 2025
Merged via the queue into renovatebot:main with commit 86bc085 May 29, 2025
40 checks passed
@renovate-release
Copy link
Copy Markdown

🎉 This PR is included in version 40.35.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lpriyasivakumar lpriyasivakumar deleted the fix/npmrc-check branch May 30, 2025 10:43
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants