1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-21 17:27:13 +01:00

tweak node setup

This commit is contained in:
Matthias Kretschmann 2021-01-30 22:15:43 +01:00
parent 8ab7ea182e
commit bfe7d40090
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 12 additions and 9 deletions

View File

@ -39,10 +39,12 @@ echo "------------------------------$(tput sgr0)"
[ -s "$HOME/.nvm" ] && . "$HOME/.nvm/nvm.sh" [ -s "$HOME/.nvm" ] && . "$HOME/.nvm/nvm.sh"
# Update to latest nvm Node.js # Update to latest nvm Node.js
nvm install node nvm install node --reinstall-packages-from=node
nvm alias default node
# update npm itself # update npm itself
npm install npm -g nvm install-latest-npm
# npm install npm -g
# update all global packages # update all global packages
npm update -g npm update -g

15
exports
View File

@ -25,19 +25,20 @@ export CDPATH=$CDPATH:~/Code
# nvm # nvm
# defer loading until needed for faster shell startup # defer loading until needed for faster shell startup
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`) # declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
#
NODE_GLOBALS+=("node") # NODE_GLOBALS+=("node")
NODE_GLOBALS+=("nvm") # NODE_GLOBALS+=("nvm")
load_nvm () { load_nvm () {
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
} }
load_nvm
for cmd in "${NODE_GLOBALS[@]}"; do # for cmd in "${NODE_GLOBALS[@]}"; do
eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }" # eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
done # done
# pip should only run if there is a virtualenv currently activated # pip should only run if there is a virtualenv currently activated
#export PIP_REQUIRE_VIRTUALENV=true #export PIP_REQUIRE_VIRTUALENV=true