plugins/node: use `_command_exists`
Addresses bash-it/bash-it#1632 alsö, quote variable, use `[[`, &c.pull/1938/head
parent
9378a8318f
commit
e701660ff1
|
|
@ -86,6 +86,7 @@ plugins/available/goenv.plugin.bash
|
||||||
plugins/available/history-search.plugin.bash
|
plugins/available/history-search.plugin.bash
|
||||||
plugins/available/history-substring-search.plugin.bash
|
plugins/available/history-substring-search.plugin.bash
|
||||||
plugins/available/history.plugin.bash
|
plugins/available/history.plugin.bash
|
||||||
|
plugins/available/node.plugin.bash
|
||||||
plugins/available/textmate.plugin.bash
|
plugins/available/textmate.plugin.bash
|
||||||
plugins/available/xterm.plugin.bash
|
plugins/available/xterm.plugin.bash
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'Node.js helper functions'
|
about-plugin 'Node.js helper functions'
|
||||||
|
|
||||||
|
# Check that we have npm
|
||||||
|
_command_exists npm || return
|
||||||
|
|
||||||
# Ensure local modules are preferred in PATH
|
# Ensure local modules are preferred in PATH
|
||||||
pathmunge "./node_modules/.bin" "after"
|
pathmunge "./node_modules/.bin" "after"
|
||||||
|
|
||||||
# Check that we have npm
|
|
||||||
out=$(command -v npm 2>&1) || return
|
|
||||||
|
|
||||||
# If not using nodenv, ensure global modules are in PATH
|
# If not using nodenv, ensure global modules are in PATH
|
||||||
if [[ ! $out == *"nodenv/shims"* ]] ; then
|
if [[ ! "$(type -p npm)" == *"nodenv/shims"* ]]; then
|
||||||
pathmunge "$(npm config get prefix)/bin" "after"
|
pathmunge "$(npm config get prefix)/bin" "after"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue