File tree 5 files changed +33
-12
lines changed
5 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ plugins/available/history.plugin.bash
99
99
plugins/available/hub.plugin.bash
100
100
plugins/available/jump.plugin.bash
101
101
plugins/available/less-pretty-cat.plugin.bash
102
+ plugins/available/nenv.plugin.bash
102
103
plugins/available/node.plugin.bash
103
104
plugins/available/nodenv.plugin.bash
104
105
plugins/available/percol.plugin.bash
Original file line number Diff line number Diff line change 1
1
# shellcheck shell=bash
2
- cite " about-completion"
3
2
about-completion " npm (Node Package Manager) completion"
4
3
5
- if _command_exists npm; then
4
+ # Test `npm version` because *env tools create shim scripts that will be found in PATH
5
+ # but do not always resolve to a working install.
6
+ if _command_exists npm && npm --version & > /dev/null; then
6
7
eval " $( npm completion) "
7
8
fi
Original file line number Diff line number Diff line change
1
+ # shellcheck shell=bash
2
+ about-plugin ' load nenv, if you are using it'
3
+
4
+ # Load after basher
5
+ # BASH_IT_LOAD_PRIORITY: 260
6
+
7
+ export NENV_ROOT=" ${NENV_ROOT:- ${HOME?} / .nenv} "
8
+
9
+ if [[ -d " ${NENV_ROOT?} /bin" ]]; then
10
+ pathmunge " ${NENV_ROOT?} /bin"
11
+ fi
12
+
13
+ if _command_exists nenv; then
14
+ eval " $( nenv init - bash) "
15
+ fi
Original file line number Diff line number Diff line change 1
1
# shellcheck shell=bash
2
- cite about-plugin
3
2
about-plugin ' Node.js helper functions'
4
3
5
- # Check that we have npm
6
- _command_exists npm || return
4
+ # Load after *env plugins
5
+ # BASH_IT_LOAD_PRIORITY: 270
7
6
8
7
# Ensure local modules are preferred in PATH
9
- pathmunge " ./node_modules/.bin" " after"
8
+ pathmunge ' ./node_modules/.bin' ' after'
10
9
11
- # If not using nodenv , ensure global modules are in PATH
12
- if [[ ! " $( type -p npm) " == * " nodenv /shims" * ]]; then
13
- pathmunge " $( npm config get prefix) /bin" " after"
10
+ # If not using an *env tool , ensure global modules are in PATH
11
+ if [[ ! " $( type -p npm) " == * ' /shims/npm ' ]]; then
12
+ pathmunge " $( npm config get prefix) /bin" ' after'
14
13
fi
Original file line number Diff line number Diff line change 1
1
# shellcheck shell=bash
2
- cite about-plugin
3
2
about-plugin ' load nodenv, if you are using it'
4
3
5
- export NODENV_ROOT=" $HOME /.nodenv"
6
- pathmunge " $NODENV_ROOT /bin"
4
+ # Load after basher
5
+ # BASH_IT_LOAD_PRIORITY: 260
6
+
7
+ export NODENV_ROOT=" ${NODENV_ROOT:- ${HOME?} / .nodenv} "
8
+
9
+ if [[ -d " ${NODENV_ROOT?} /bin" ]]; then
10
+ pathmunge " ${NODENV_ROOT?} /bin"
11
+ fi
7
12
8
13
if _command_exists nodenv; then
9
14
eval " $( nodenv init - bash) "
You can’t perform that action at this time.
0 commit comments