From dd9061cb541fd62e5dd60f7fbc439e82dfdf75ad Mon Sep 17 00:00:00 2001 From: laggardkernel Date: Thu, 25 Apr 2019 16:00:34 +0800 Subject: [PATCH] node: support environment variables NVM_DIR and NODENV_ROOT --- modules/node/init.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/node/init.zsh b/modules/node/init.zsh index d8eea14..1ea66f9 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -7,8 +7,8 @@ # # Load manually installed NVM into the shell session. -if [[ -s "$HOME/.nvm/nvm.sh" ]]; then - source "$HOME/.nvm/nvm.sh" +if [[ -s "${NVM_DIR:=$HOME/.nvm}/nvm.sh" ]]; then + source "${NVM_DIR}/nvm.sh" # Load package manager installed NVM into the shell session. elif (( $+commands[brew] )) && \ @@ -17,8 +17,8 @@ elif (( $+commands[brew] )) && \ unset nvm_prefix # Load manually installed nodenv into the shell session. -elif [[ -s "$HOME/.nodenv/bin/nodenv" ]]; then - path=("$HOME/.nodenv/bin" $path) +elif [[ -s "${NODENV_ROOT:=$HOME/.nodenv}/bin/nodenv" ]]; then + path=("${NODENV_ROOT}/bin" $path) eval "$(nodenv init - --no-rehash zsh)" # Load package manager installed nodenv into the shell session.