-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(npm): support Yarn 2 offline cache and zero-installs #7220
feat(npm): support Yarn 2 offline cache and zero-installs #7220
Conversation
163faf8
to
52659ef
Compare
52659ef
to
de99046
Compare
The refactoring makes this a little hard to review changes. Ideally do it before or after the PR which makes the changes, so that it's clear which bits are refactor-only and which is the part that needs reviewing. |
@rarkins Only the second commit 06ac7aa?diff=split&w=1 is the relevant change. |
lib/manager/npm/post-update/index.ts
Outdated
const yarnrc = await getFile(upath.join(lockFileDir, '.yarnrc')); | ||
const yarnrcYml = await getFile(upath.join(lockFileDir, '.yarnrc.yml')); | ||
|
||
if (yarnrc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend to switch those two blocks (first check for .yarnrc.yml
, then for .yarnrc
). In my work repo for instance, we have both a .yarnrc
and a .yarnrc.yml
, with the first one pointing to a binary explaining that the global Yarn isn't recent enough because it doesn't read .yarnrc.yml
, and needs to be upgraded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a minimum version of Yarn v1 that supports "bootstrapping" Yarn v2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yarn 1 reading paths from .yarnrc.yml
started with 1.18.0. Before that it was still possible, but you had to put the right path in both files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR 😄
lib/manager/npm/post-update/index.ts
Outdated
} | ||
} else if (yarnrcYml) { | ||
// Yarn 2 (offline cache and zero-installs) | ||
const config = parseSyml(yarnrcYml); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw, the name is a bit misleading but it's regular YAML, so you can use any parser you want, not necessarily the Yarn one. Or you can use the Configuration
class from @yarnpkg/core
(which would take care of the default values, etc), but it's perhaps a bit more complicated than necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arcanis Thank you for your valuable comments!
parseSyml
is already used to parse the lockfile:
renovate/lib/manager/npm/extract/yarn.ts
Line 15 in c65d400
const parsed = parseSyml(yarnLockRaw); |
@yarnpkg/parsers
seems to use js-yaml
so I think it's OK and would give more consistent behavior with Yarn, e.g., empty file handling.
1837f31
to
06342b6
Compare
🎉 This PR is included in version 23.53.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Thank you. I've tested it and it works now. It does commit the changes in the cache folder. |
Is 23.53.0 live on Github? I'm not seeing this change in effect. |
This PR adds support for Yarn 2 offline cache and zero-installs.
Examples: https://github.com/ylemkimon/renovate-berry/pull/2, https://github.com/ylemkimon/renovate-berry/pull/3
/cc @arcanis Could you check whether this is correct/enough to support zero-installs?