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(plugin-yarn): add support for yarn berry #12374

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

Conversation

favna
Copy link

@favna favna commented Apr 22, 2024

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

  • This updates the yarn plugin to better support Yarn berry (aka Yarn v2 and beyond) because some commands are no longer available or changed in modern Yarn.
  • A new pair of aliases yii and yifl are added. These are to install dependencies while locking versions down to the yarn.lock file. The reason yifl is an alias for yii is to respect that for v1 it's yarn install --frozen-lockfile, whereas for berry it's yarn install --immutable, so yii.
  • The aliases ydlx and yn are added to cover yarn dlx and yarn node

Other comments:

Version checking inspired by the git plugin

This updates the yarn plugin to better support Yarn berry (aka Yarn v2 and beyond) because some commands are no longer available or changed in modern Yarn.
@ohmyzsh ohmyzsh bot added Area: plugin Issue or PR related to a plugin Topic: alias Pull Request or issue regarding aliases labels Apr 22, 2024
Copy link
Member

@carlosala carlosala left a comment

Choose a reason for hiding this comment

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

yarn --version is a really slow command. In my tests it was around 150ms for v1 and 300ms for v4.
We can't add 300ms in startup, it'd make it really slow.
I like the idea though, and I propose using a zstyle config for it, like global-path

@carlosala carlosala self-assigned this Apr 22, 2024
@favna
Copy link
Author

favna commented Apr 22, 2024

I like the idea though, and I propose using a zstyle config for it, like global-path

I'm not familiar with this. Can you provide a resource? Also, do you mean that through a zstyle the user would configure if they want the Yarn v1 or Yarn Berry set?

@carlosala
Copy link
Member

Yep, I mean exactly that. You can see an example in yarn plugin precisely, the config is called global-path. Here you have the zsh manual! https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module

@ohmyzsh ohmyzsh bot added the Type: documentation Documentation issue or Pull Request label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: plugin Issue or PR related to a plugin Topic: alias Pull Request or issue regarding aliases Type: documentation Documentation issue or Pull Request
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

None yet

2 participants