Merge pull request #1636 from cornfeedhobo/cleanup-node-plugin

Ensure node plugin plays nice with nodenv
pull/1642/head
Nils Winkler 2020-07-09 11:29:49 +02:00 committed by GitHub
commit 63fc3e76bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,13 @@
cite about-plugin cite about-plugin
about-plugin 'Node.js helper functions' about-plugin 'Node.js helper functions'
# Ensure local modules are preferred in PATH
pathmunge "./node_modules/.bin" "after" pathmunge "./node_modules/.bin" "after"
# Make sure the global npm prefix is on the path # Check that we have npm
[[ `which npm 2>/dev/null` ]] && pathmunge "$(npm config get prefix)/bin" "after" out=$(command -v npm 2>&1) || return
# If not using nodenv, ensure global modules are in PATH
if [[ ! $out == *"nodenv/shims"* ]] ; then
pathmunge "$(npm config get prefix)/bin" "after"
fi