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 yarn berry #229

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

chloe463
Copy link
Contributor

@chloe463 chloe463 commented May 6, 2024

Hello!

This pull request adds support for Yarn Berry, the latest version of Yarn package manager. In Yarn Berry, the --frozen-lock-file option has been deprecated and replaced with --immutable. I have updated the code to use the --immutable option and also adjusted the cache directory path to $HOME/.yarn/berry/cache.

I believe these changes are straightforward, but if you have any suggestions or improvements, please let me know. I'm open to feedback and would appreciate your insights. Thank you for considering these changes.

inputPaths = [path.join(homeDirectory, '.cache', 'yarn')]
inputPaths = useYarnV1
? [path.join(homeDirectory, '.cache', 'yarn')]
: [path.join(homeDirectory, '.yarn', 'berry', 'cache')]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran yarn info --cache in repository which using yarn v4 and it says that the cache is in "$HOME/.yarn/berry/cache".

@@ -127,7 +128,9 @@ const install = (opts = {}) => {
return io.which('yarn', true).then(yarnPath => {
console.log('yarn at "%s"', yarnPath)

const args = shouldUsePackageLock ? ['--frozen-lockfile'] : []
const args = shouldUsePackageLock
? [shouldUseYarnV1 ? '--frozen-lockfile' : '--immutable']
Copy link
Contributor Author

Choose a reason for hiding this comment

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

--frozen-lockfile is for v1 and --immutable is for v2 and more.

@chloe463
Copy link
Contributor Author

chloe463 commented May 6, 2024

@bahmutov
May I ask for your review on this?

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.

1 participant