2022-02-03 21:42:47 +08:00
|
|
|
if zstyle -T ':omz:plugins:yarn' global-path; then
|
|
|
|
# Skip yarn call if default global bin dir exists
|
|
|
|
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
|
2021-12-29 22:19:59 +08:00
|
|
|
|
2022-02-03 21:42:47 +08:00
|
|
|
# Add yarn bin directory to $PATH if it exists and not already in $PATH
|
|
|
|
[[ $? -eq 0 ]] \
|
|
|
|
&& [[ -d "$bindir" ]] \
|
|
|
|
&& (( ! ${path[(Ie)$bindir]} )) \
|
|
|
|
&& path+=("$bindir")
|
|
|
|
unset bindir
|
|
|
|
fi
|
2020-10-31 23:01:18 +08:00
|
|
|
|
2018-07-12 03:21:01 +08:00
|
|
|
alias y="yarn"
|
2017-11-05 01:41:14 +08:00
|
|
|
alias ya="yarn add"
|
2018-07-12 03:21:01 +08:00
|
|
|
alias yad="yarn add --dev"
|
|
|
|
alias yap="yarn add --peer"
|
|
|
|
alias yb="yarn build"
|
2017-11-05 01:41:14 +08:00
|
|
|
alias ycc="yarn cache clean"
|
2019-10-02 04:24:00 +08:00
|
|
|
alias yd="yarn dev"
|
2022-12-05 21:18:18 +08:00
|
|
|
alias yf="yarn format"
|
2017-11-05 01:41:14 +08:00
|
|
|
alias yh="yarn help"
|
2018-10-29 02:27:34 +08:00
|
|
|
alias yi="yarn init"
|
2018-07-12 03:21:01 +08:00
|
|
|
alias yin="yarn install"
|
2019-12-20 10:35:50 +08:00
|
|
|
alias yln="yarn lint"
|
2021-10-04 19:07:55 +08:00
|
|
|
alias ylnf="yarn lint --fix"
|
2018-10-29 02:27:34 +08:00
|
|
|
alias yp="yarn pack"
|
2018-07-12 03:21:01 +08:00
|
|
|
alias yrm="yarn remove"
|
|
|
|
alias yrun="yarn run"
|
2018-10-29 02:27:34 +08:00
|
|
|
alias ys="yarn serve"
|
2018-07-12 03:21:01 +08:00
|
|
|
alias yst="yarn start"
|
|
|
|
alias yt="yarn test"
|
2019-10-09 02:38:25 +08:00
|
|
|
alias ytc="yarn test --coverage"
|
2017-11-05 01:41:14 +08:00
|
|
|
alias yui="yarn upgrade-interactive"
|
2018-07-12 03:21:01 +08:00
|
|
|
alias yup="yarn upgrade"
|
2019-10-09 21:17:05 +08:00
|
|
|
alias yv="yarn version"
|
2019-01-03 04:12:13 +08:00
|
|
|
alias yw="yarn workspace"
|
|
|
|
alias yws="yarn workspaces"
|
2023-01-10 04:51:50 +08:00
|
|
|
alias yy="yarn why"
|
2024-05-31 02:31:39 +08:00
|
|
|
|
|
|
|
# Commands that are specific to the yarn version being used
|
|
|
|
if zstyle -t ':omz:plugins:yarn' berry; then
|
|
|
|
# aliases that differ
|
|
|
|
alias yuil='yui' # --latest flag was removed in yarn berry
|
|
|
|
alias yii='yarn install --immutable'
|
|
|
|
alias yifl='yarn install --immutable'
|
|
|
|
|
|
|
|
# unique aliases
|
|
|
|
alias ydlx="yarn dlx"
|
|
|
|
alias yn="yarn node"
|
|
|
|
else
|
|
|
|
# aliases that differ
|
|
|
|
alias yuil='yarn upgrade-interactive --latest'
|
|
|
|
alias yii='yarn install --frozen-lockfile'
|
|
|
|
alias yifl='yarn install --frozen-lockfile'
|
|
|
|
|
|
|
|
# unique aliases
|
|
|
|
alias yga="yarn global add"
|
|
|
|
alias ygls="yarn global list"
|
|
|
|
alias ygrm="yarn global remove"
|
|
|
|
alias ygu="yarn global upgrade"
|
|
|
|
alias yls="yarn list"
|
|
|
|
alias yout="yarn outdated"
|
|
|
|
alias yuca="yarn global upgrade && yarn cache clean"
|
|
|
|
fi
|