mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Update yarn.plugin.zsh
This commit is contained in:
parent
32bcb88005
commit
80fc777fac
1 changed files with 25 additions and 10 deletions
|
|
@ -1,6 +1,9 @@
|
|||
# Yarn version checking
|
||||
autoload -Uz is-at-least
|
||||
yarn_version="$(yarn --version 2>/dev/null)"
|
||||
# Get the configured version of yarn
|
||||
is_yarn_berry="false"
|
||||
|
||||
if zstyle -t ':omz:plugins:yarn' berry; then
|
||||
is_yarn_berry="true"
|
||||
fi
|
||||
|
||||
if zstyle -T ':omz:plugins:yarn' global-path; then
|
||||
# Skip yarn call if default global bin dir exists
|
||||
|
|
@ -35,14 +38,21 @@ alias yst="yarn start"
|
|||
alias yt="yarn test"
|
||||
alias ytc="yarn test --coverage"
|
||||
alias yui="yarn upgrade-interactive"
|
||||
|
||||
# --latest flag was removed in yarn berry so we execute the base command
|
||||
is-at-least 2.0.0 "$yarn_version" \
|
||||
&& alias yuil='yui' \
|
||||
|| alias yuil='yarn upgrade-interactive --latest'
|
||||
if [[ ${is_yarn_berry} == "true" ]]; then
|
||||
alias yuil='yui'
|
||||
else
|
||||
alias yuil='yarn upgrade-interactive --latest'
|
||||
fi
|
||||
|
||||
# The flag for installing with restrictive lockfile was changed in yarn berry
|
||||
is-at-least 2.0.0 "$yarn_version" \
|
||||
&& alias yii='yarn install --immutable' \
|
||||
|| alias yii='yarn install --frozen-lockfile'
|
||||
if [[ ${is_yarn_berry} == "true" ]]; then
|
||||
alias yii='yarn install --immutable'
|
||||
else
|
||||
alias yii='yarn install --frozen-lockfile'
|
||||
fi
|
||||
|
||||
alias yifl="yii"
|
||||
alias yup="yarn upgrade"
|
||||
alias yv="yarn version"
|
||||
|
|
@ -51,7 +61,7 @@ alias yws="yarn workspaces"
|
|||
alias yy="yarn why"
|
||||
|
||||
# These commands should only be registered if Yarn v1 is used
|
||||
if [ ! $(is-at-least 2.0.0 "$yarn_version") ]; then
|
||||
if [[ ${is_yarn_berry} == "false" ]]; then
|
||||
alias yga="yarn global add"
|
||||
alias ygls="yarn global list"
|
||||
alias ygrm="yarn global remove"
|
||||
|
|
@ -59,4 +69,9 @@ if [ ! $(is-at-least 2.0.0 "$yarn_version") ]; then
|
|||
alias yls="yarn list"
|
||||
alias yout="yarn outdated"
|
||||
alias yuca="yarn global upgrade && yarn cache clean"
|
||||
else
|
||||
alias ydlx="yarn dlx"
|
||||
alias yn="yarn node"
|
||||
fi
|
||||
|
||||
unset is_yarn_berry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue