dev/+js: use nvm to manage node
This commit is contained in:
parent
4ebe18eb8b
commit
48af02684f
|
@ -1 +1,4 @@
|
|||
path=(./node_modules/.bin $path)
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
brew install node
|
||||
;;
|
||||
linux*)
|
||||
if [[ -f /etc/arch-release ]]; then
|
||||
sudo pacman --needed --noconfirm -S nodejs npm
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ ! -d ~/.nvm ]]; then
|
||||
git clone https://github.com/creationix/nvm ~/.nvm
|
||||
cd $HOME/.nvm && git checkout v0.33.2
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
. $HOME/.nvm/nvm.sh
|
||||
|
||||
nvm install node
|
||||
fi
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
npm=$(which npm)
|
||||
[[ -w $npm ]] || npm="sudo $npm"
|
||||
$npm -g update
|
||||
(
|
||||
cd "$NVM_DIR"
|
||||
git fetch origin
|
||||
git checkout $(git describe --abbrev=0 --tags --match "v[0-9]*" origin)
|
||||
) && . "$NVM_DIR/nvm.sh"
|
||||
|
||||
nvm run node update -g
|
||||
|
|
Loading…
Reference in a new issue