support for local npm packages when loading shell

This commit is contained in:
Bruno Pinto 2013-03-10 14:23:01 -03:00
parent fadb1fe446
commit 9caa7af7b8

View File

@ -1,10 +1,5 @@
if test -d /usr/local/share/npm/bin ### Functions
set PATH /usr/local/share/npm/bin $PATH function __remove_local_npm_binaries_from_path
end
function __check_node_project --on-variable PWD --description 'Setup local npm binaries on directory change'
status --is-command-substitution; and return
set -l count 1 set -l count 1
for path in $PATH for path in $PATH
@ -14,10 +9,25 @@ function __check_node_project --on-variable PWD --description 'Setup local npm b
set count (math $count + 1) set count (math $count + 1)
end end
end end
end
function __add_local_npm_binaries_to_path
for path in $PWD/node_modules/*/bin for path in $PWD/node_modules/*/bin
set PATH $path $PATH set PATH $path $PATH
end end
end
set -e count
### Main program
if test -d /usr/local/share/npm/bin
set PATH /usr/local/share/npm/bin $PATH
end
__add_local_npm_binaries_to_path
function __check_node_project --on-variable PWD --description 'Setup local npm binaries on directory change'
status --is-command-substitution; and return
__remove_local_npm_binaries_from_path
__add_local_npm_binaries_to_path
end end