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

Add Yarn2 lockfile parser #83

Closed

Conversation

Adjective-Object
Copy link

Opening this to deal with #36 and microsoft/lage#129

Supports parsing yarn2 lockfiles directly. This change omits a portion of the normalization logic from from snyk's similar change.

When snyk is importing the lockfile, they create every possible representation of a dependency and store duplicate entries for each in their internal representation of a package's lockfile. No other parser in workspace-tools does this at present, so I instead opted for normalizing out the protocol from npm: and file: dependencies (to bring it in line with yarn1 lockfiles), and omitting dependencies where there are incongruities between yarn2's locking and pnpm/yarn1's locking (e.g. workspace dependencies).

@Adjective-Object Adjective-Object changed the title Add Yarn2 parser Add Yarn2 lockfile parser Nov 6, 2021
@Adjective-Object
Copy link
Author

Build is failing because workspace-tools is stuck on typescript @ 3.8 and fails to parse the declaration files in @yarnpkg/core :(

@AkimaLunar
Copy link
Member

@Adjective-Object, do you need help with the rebase? I just recently added npm 7+ WS support, so this part of the codebase is still pretty fresh in my mind. If you don't have capacity to work on this any more, I could take over.

@kenotron
Copy link
Member

kenotron commented Jan 7, 2022

#86 upgrades us to ts4.5. I'll have that done soon. Though I want to caution that if we take on a dep on berry code that:

  1. it doesn't get loaded by default - this slows the library down drastically! Please load it with require() - I know it's ugly and not ES compliant, but it is currently the only way to ensure your lib is super fast without making the entire API surface async
  2. make sure that the @yarnpkg/core code is not conflicting with the @yarnpkg/lockfile that parses yarn v1

@shaulgo
Copy link

shaulgo commented Mar 24, 2022

Any idea when this will be merged?

@Adjective-Object
Copy link
Author

I ended up adopting turbo rather than lage for the personal project that used yarn2, so my I don't need this change merged anymore. If someone else needs it, they're welcome to take this work as a baseline to implement support.

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.

4 participants