Improve nvm usage

This commit is contained in:
Augusto Gunsch 2022-06-26 15:41:10 +02:00
parent c7c90e89e1
commit eb2f40a95d
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 19 additions and 2 deletions

View File

@ -53,5 +53,22 @@ goto() {
} }
# NVM - Dynamic loading trick # NVM - Dynamic loading trick
alias nvm="unalias nvm && [ -z $NVM_LOADED ] && export NVM_LOADED=1 && source /usr/share/nvm/init-nvm.sh ; nvm" alias nvm="load_nvm; nvm"
alias node="unalias node && [ -z $NVM_LOADED ] && export NVM_LOADED=1 && source /usr/share/nvm/init-nvm.sh ; node" alias node="load_nvm; node"
alias npm="load_nvm; npm"
alias npx="load_nvm; npx"
alias create-react-app="load_nvm; create-react-app"
export NVM_DIR="$HOME/.nvm"
load_nvm() {
if [ -z $NVM_LOADED ]; then
export NVM_LOADED=1
unalias nvm
unalias node
unalias npm
unalias npx
unalias create-react-app
. "$NVM_DIR/nvm.sh"
. "$NVM_DIR/bash_completion"
fi
}