-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: modern yarn lockfile parsing error #1597
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
fix: modern yarn lockfile parsing error #1597
Conversation
Someone is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
@erj826 thanks for this! Out of curiosity what version of yarn are you using? |
@tknickman yarn 3.2.2 |
Thanks for the additional info, this looks good. I was playing around with it locally, and with the same version yarn auto corrects the formatting in my pruned That being said the current behavior is definitely not correct so this fix looks great. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Somewhat humorous, despite this improving the format of the lockfile, this breaks Now, I get |
@quinnturner now it seems like yarn is able to parse the lockfile and catch that the prune-generated lockfile doesn't include the resolution field -- which your comment on #643 looks like it'll fix? |
Exactly, yep! @erj826 I have a WIP that may or may not work out where I expand on that change by fully supporting Yarn Berry as a backend. My goal is to split up the Lockfile definition into separate definitions, one per backend. No promises though, as I am newer to go and have other commitments 😄 EDIT: here is my WIP quinnturner#2, for those who are interested. It breaks up the Yarn Berry and Yarn Classic parsing. There is a bunch of code duplication which needs to be cleaned up eventually. I have it set the correct version and cache key. |
Description
The header string written to the pruned lockfile by the
turbo prune
command starts each of the metadata fields at the beginning of a line. This causes the__metadata
,version
, andcache_key
fields to be parsed as separate fields, when really theversion
andcache_key
should be nested within__metadata
. Turbo throws an error here when running ayarn workspaces focus my-app
install afterwards due to the un-nested metadata:Solution
Because the yamlEncoder sets the indent to two, adding two spaces before each of the fields should make this valid syntax.
Before:
After:
Env
Yarn v3.2.2
Turborepo v1.3.4