Skip to content

Draft: Yarn v2 support

Fabien Catteau requested to merge yarn2 into master

What does this MR do?

Support yarn.lock files generated by yarn 2, while keeping backward compatibility with yarn 1.

Lock files created by both yarn 1 and yarn 2 share a similar schema, but yarn 2 lock files are YAML files, whereas yarn 1 lock files are not. The parser is changed to handle YAML files, and it features a preprocessor that converts yarn 1 lock files to YAML, when needed.

yarn 2 currently sets the lock file version to 4, in the metadata of the lock file. Newer versions might not be compatible, so the parser reports an error if the version is greater than 4. As for the lock files generated by yarn 1, the parser expects one particular generated comment, at the beginning of the file. It assumes this is a YAML file if this v1-specific comment is missing.

What are the relevant issue numbers?

gitlab-org/gitlab#263358 (closed)

Does this MR meet the acceptance criteria?

Edited by Fabien Catteau

Merge request reports