dev/+js: use nvm to manage node

This commit is contained in:
Henrik Lissner 2017-07-17 13:19:02 +02:00
parent 4ebe18eb8b
commit 48af02684f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 18 additions and 13 deletions

View file

@ -1 +1,4 @@
path=(./node_modules/.bin $path) path=(./node_modules/.bin $path)
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"

View file

@ -1,12 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
case $OSTYPE in if [[ ! -d ~/.nvm ]]; then
darwin*) git clone https://github.com/creationix/nvm ~/.nvm
brew install node cd $HOME/.nvm && git checkout v0.33.2
;; export NVM_DIR="$HOME/.nvm"
linux*) . $HOME/.nvm/nvm.sh
if [[ -f /etc/arch-release ]]; then
sudo pacman --needed --noconfirm -S nodejs npm nvm install node
fi fi
;;
esac

View file

@ -1,5 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
npm=$(which npm) (
[[ -w $npm ]] || npm="sudo $npm" cd "$NVM_DIR"
$npm -g update git fetch origin
git checkout $(git describe --abbrev=0 --tags --match "v[0-9]*" origin)
) && . "$NVM_DIR/nvm.sh"
nvm run node update -g