-
-
Save nunofgs/bd99074e2620d769be20e123a341bfd8 to your computer and use it in GitHub Desktop.
Adds node_modules/.bin to the PATH (zsh)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((!$+commands[npm])); then | |
return 1 | |
fi | |
# Adds node_modules/.bin to the PATH | |
npm_bin_hook() { | |
if [ -n "${OLDPATH+x}" ]; then | |
PATH=$OLDPATH | |
unset OLDPATH | |
fi | |
if [ -f package.json ]; then | |
OLDPATH=$PATH | |
PATH=$PWD/node_modules/.bin:$PATH | |
fi | |
} | |
add-zsh-hook chpwd npm_bin_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment