fix(dependency-path): fix lockfile v6 version parsing for a patched dependency#5964
Conversation
|
💖 Thanks for opening this pull request! 💖 |
| version: '1.0.0', | ||
| }) | ||
|
|
||
| expect(parse('/foo/1.0.0_k5brw22k7hadiw3hedogf4eiee(bar@1.0.0)')).toStrictEqual({ |
There was a problem hiding this comment.
I wonder if we need to make this syntax a bit more readable in the new format.
We could change it to something like
| expect(parse('/foo/1.0.0_k5brw22k7hadiw3hedogf4eiee(bar@1.0.0)')).toStrictEqual({ | |
| expect(parse('/foo/1.0.0(patch_hash=k5brw22k7hadiw3hedogf4eiee)(bar@1.0.0)')).toStrictEqual({ |
There was a problem hiding this comment.
Not sure. It makes sense for patch hash to be part of the version. It might blend in with peer dependencies too much otherwise.
But up to you, we can close this PR if you plan on updating the format.
There was a problem hiding this comment.
I think with my suggestion it is easier to parse the dependency path because the version will always end with (. With your suggestion the version will end with either _ or (.
There was a problem hiding this comment.
The input to the parse function has _ in it. If I change the function to return (patch_hash=....) then I am getting:
Broken lockfile: no entry for '/ts-node/10.9.1_k5brw22k7hadiw3hedogf4eiee(@swc/core@1.3.27)(@types/node@18.11.18)(typescript@4.9.4)' in pnpm-lock.yaml
Which makes sense since in the packages list we now have this, but all the references to ts-node have the path from the error.
/ts-node@10.9.1(patch_hash=k5brw22k7hadiw3hedogf4eiee)(@swc/core@1.3.27)(@types/node@18.11.18)(typescript@4.9.4)I am going to close my PR, since it does not work either.
If I delete node_modules and run pnpm i with the updated lock file, I am getting the following error:
Package name mismatch found while reading {"integrity":"sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==","registry":"https://registry.npmjs.org/","tarball":"https://registry.npmjs.org/ts-node/-/ts-node-10.9.1_k5brw22k7hadiw3hedogf4eiee.tgz"} from the store. This means that the lockfile is broken. Expected package: ts-node@10.9.1_k5brw22k7hadiw3hedogf4eiee. Actual package in the store by the given integrity: ts-node@10.9.1
…ependency Previously pnpm would fail to resolve patched package when lockfile v6 is used. This change correctly handles patch hash in the version suffix.
|
Closing, since solution in PR does not work |
|
Filed an issue about it: #5967 |
Previously pnpm would fail to resolve patched package when lockfile v6 is used. This change correctly handles patch hash in the version suffix.