Skip to content

fix: reuse catalog resolutions of npm aliases correctly#8281

Merged
zkochan merged 2 commits intomainfrom
gluxon/catalog-fix-alias
Jul 5, 2024
Merged

fix: reuse catalog resolutions of npm aliases correctly#8281
zkochan merged 2 commits intomainfrom
gluxon/catalog-fix-alias

Conversation

@gluxon
Copy link
Member

@gluxon gluxon commented Jul 5, 2024

Problem

When running pnpm update in this repo, pnpm looks for execa@0.1.2 and 404s instead of looking for safe-execa@0.1.2.

Screenshot 2024-07-04 at 8 40 17 PM

This is because of a bug in my prior PR from a few days ago. 🤦🏻‍♂️

The repo uses the catalog specifier for execa. The change above isn't handling npm aliases correctly.

execa: npm:safe-execa@0.1.2

Changes

Using replaceVersionInPref to fix the bug above. This function handles npm: specifiers correctly.

We're currently using this function elsewhere for a very similar short-circuiting purpose.

wantedDependency.pref = replaceVersionInPref(wantedDependency.pref, currentPkg.version)

@gluxon
Copy link
Member Author

gluxon commented Jul 5, 2024

I had a more complicated fix in #8280, but went with the one here after realizing the catalog snapshot version should probably stay as concrete versions for now. Otherwise we'd store peers suffixes in the catalog snapshot, which was never intended.

@gluxon gluxon changed the title fix: reuse catalog resolutions of complex version references correctly fix: reuse catalog resolutions of npm aliases correctly Jul 5, 2024
@gluxon gluxon marked this pull request as ready for review July 5, 2024 04:54
@gluxon gluxon requested a review from zkochan as a code owner July 5, 2024 04:54
@zkochan
Copy link
Member

zkochan commented Jul 5, 2024

Looks complicated but if it works, let it be, I guess.

@zkochan zkochan merged commit 08fd918 into main Jul 5, 2024
@zkochan zkochan deleted the gluxon/catalog-fix-alias branch July 5, 2024 11:51
@gluxon gluxon mentioned this pull request Jul 7, 2024
18 tasks
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.

2 participants