Unverified Commit d9c58d5f authored by Carlo Sala's avatar Carlo Sala Committed by GitHub

feat(yarn): add setting to disable adding global dir to `$PATH` (#10642)

parent e1a9d0ce
......@@ -9,6 +9,15 @@ To use it, add `yarn` to the plugins array in your zshrc file:
plugins=(... yarn)
```
## Global scripts directory
It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`.
To disable this feature, set the following style in your `.zshrc`:
```zsh
zstyle ':omz:plugins:yarn' global-path false
```
## Aliases
| Alias | Command | Description |
......
# Skip yarn call if default global bin dir exists
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
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)"
# 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
# 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
alias y="yarn"
alias ya="yarn add"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment