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