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

feat(npm): fuzzy merge registries in .yarnrc.yml #26922

Merged
merged 11 commits into from
Jan 30, 2024

Conversation

RGunning
Copy link
Contributor

Changes

match registries in the npmRegistries fuzzily, so that //my.registry will match with https://my.registry when merging .yarnrc.yml files instead of creating a .yarnrc.yml with 2 registries.

Context

see: #26919

At the moment, when constructing the yarnrc from the hostRules the https: prefix is stripped off the url, however, configuring yarn@4 with yarn config set --home npmRegistryServer "https://my-private-regsistry" && yarn config login would set the protocol on the registry on the developers machine. this then causes problems when a repository needs to set additional npm config e.g. npmAlwaysAuth

Proposed fix is that instead of merging in such a way that 2 items in the npmRegistries are created, we instead fizzy match to identify that the registry is the same so they should be the same item in the registries array.

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

@viceice viceice changed the title feat: fuzzy merge registries in .yarnrc.yml feat(npm): fuzzy merge registries in .yarnrc.yml Jan 29, 2024
Copy link
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.

looks good, just some small things 😊

lib/modules/manager/npm/post-update/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/npm/post-update/index.ts Show resolved Hide resolved
lib/modules/manager/npm/post-update/index.ts Outdated Show resolved Hide resolved
use a Map to reduce the number of calculations
@rarkins rarkins requested a review from viceice January 30, 2024 06:03
move fuzzyMatchAdditionalYarnrcYml and remove tests that are now covered by a mock
viceice
viceice previously approved these changes Jan 30, 2024
@rarkins rarkins added this pull request to the merge queue Jan 30, 2024
Merged via the queue into renovatebot:main with commit 88daaf5 Jan 30, 2024
36 checks passed
@RGunning RGunning deleted the feat/fuzzyMergeYarnRc branch January 30, 2024 08:37
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.161.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

rvanbutselaar pushed a commit to rvanbutselaar/renovate that referenced this pull request Feb 2, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
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