1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 10:22:00 +00:00

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

This commit is contained in:
Carlo Sala 2022-02-03 14:42:47 +01:00 committed by GitHub
parent e1a9d0ce3e
commit d9c58d5fa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 8 deletions

View file

@ -9,6 +9,15 @@ To use it, add `yarn` to the plugins array in your zshrc file:
plugins=(... yarn) 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 ## Aliases
| Alias | Command | Description | | Alias | Command | Description |

View file

@ -1,3 +1,4 @@
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
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)" [[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
@ -7,6 +8,7 @@
&& (( ! ${path[(Ie)$bindir]} )) \ && (( ! ${path[(Ie)$bindir]} )) \
&& path+=("$bindir") && path+=("$bindir")
unset bindir unset bindir
fi
alias y="yarn" alias y="yarn"
alias ya="yarn add" alias ya="yarn add"