From 77302fd4c5749e096e0e8f2c3ac3d103fe33b5dc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 17 Jul 2017 15:05:14 +0200 Subject: [PATCH] dev/+js: speed up nvm init --- dev/+js/env.zsh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dev/+js/env.zsh b/dev/+js/env.zsh index eba0f19e..8347318c 100644 --- a/dev/+js/env.zsh +++ b/dev/+js/env.zsh @@ -1,4 +1,13 @@ -path=(./node_modules/.bin $path) export NVM_DIR="$HOME/.nvm" -[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" + +# [[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" + +# Sourcing nvm.sh adds a noticable slow-down on startup, so we scan for +# the current version's path ourselves. +# NOTE This assumes you use the `node` nvm alias, e.g. `nvm install node` +npmpaths=( $HOME/.nvm/versions/node/*/bin(On) ) +path=("${npmpaths[1]}" $path) + +# Local binaries take priority +path=(./node_modules/.bin $path)