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: add support for PNPM v9 lockfiles #934

Merged
merged 13 commits into from
Apr 30, 2024
Merged

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Apr 18, 2024

This adds support for v9 PNPM lockfiles which has a different structure that looks to be similar to Yarn v2+ lockfiles.

I can't find a lot of clear detail on the actual changes so I've started with just a "best effort" approach - most notably this means dev grouping is lost because that detail is not represented in the new format; we could probably successfully determine it by checking in snapshots but that would be a lot more work so I'm leaving that as a follow up.

The good news is it seems like going forward the lockfile version should match the major verison of PNPM (pnpm/pnpm#7861) which should make it easier to track these, and we can probably drop explicit support for older versions in v2.

Resolves #931

Copy link
Contributor

Choose a reason for hiding this comment

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

since there are same codes among the tests, shall we factor out the common parts? only the file path and expected packages details are different

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if this wasn't Go I'd be more inclined to say "yes", but I think trying to refactor this would just be very messy and so it's probably best to just leave it for now given I've already written out the tests and we're not expecting them to change.

Copy link
Collaborator

@oliverchang oliverchang left a comment

Choose a reason for hiding this comment

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

LGTM with just one nit, thanks!

pkg/lockfile/parse-pnpm-lock.go Show resolved Hide resolved
@oliverchang oliverchang merged commit 83efb37 into google:main Apr 30, 2024
13 checks passed
@G-Rath G-Rath deleted the fix-pnpm branch April 30, 2024 22:56
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.

encountering errors when parsing pnpm-lock
3 participants