From f0bbef1a070b7b00a36010c44af3c88807c73e6f Mon Sep 17 00:00:00 2001 From: Cxarli <10348289+Cxarli@users.noreply.github.com> Date: Sat, 31 Oct 2020 16:01:18 +0100 Subject: [PATCH] feat(yarn): add global bin directory to `$PATH` (#9410) Fixes #9177 Closes #9410 --- plugins/yarn/yarn.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index a240cb88..a4f595c6 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,3 +1,10 @@ +# Add yarn bin directory to $PATH if it exists and not in $PATH already +bindir=$(yarn global bin 2>/dev/null) \ + && [[ -d "$bindir" ]] \ + && (( ! ${path[(Ie)$bindir]} )) \ + && path+=("$bindir") +unset bindir + alias y="yarn" alias ya="yarn add" alias yad="yarn add --dev"