fix: reuse catalog resolutions of complex version references correctly#8280
Closed
fix: reuse catalog resolutions of complex version references correctly#8280
Conversation
gluxon
commented
Jul 5, 2024
Comment on lines
+15
to
+23
| // Note: The version recorded here is used for lookups of this cataloged | ||
| // dependency in future installs. This should be computed the same as | ||
| // other version refs in the lockfile. | ||
| version: depPathToRef(dep.pkgId, { | ||
| alias: dep.alias, | ||
| realName: dep.name, | ||
| resolution: dep.resolution, | ||
| }), |
Member
Author
There was a problem hiding this comment.
As noted in the PR description, this follows how we compute the version ref for importers.
pnpm/pkg-manager/resolve-dependencies/src/index.ts
Lines 395 to 399 in 0406d4a
cfa55a5 to
660d462
Compare
660d462 to
14c2a1a
Compare
Member
Author
|
Going with a slightly different approach. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
I noticed in the pnpm repo that the catalog snapshot version we're storing for npm aliases is wrong.
It should match the version used by importers. (i.e.
safe-execa@0.1.2)This caused a bug where
pnpm updateaccidentally looked forexeca@0.1.2and 404'ed instead of looking forsafe-execa@0.1.2.Changes
Using the
depPathToReffunction to compute the version stored for thepnpm-lock.yamlcatalogssection, similar to how we compute the version ref for theimporterssection.pnpm/pkg-manager/resolve-dependencies/src/index.ts
Lines 395 to 399 in 0406d4a
After this change, catalog snapshots store the right version reference.
On the resolution side, we also need to parse the stored version reference correctly.