dev/+js: use nvm to manage node
This commit is contained in:
parent
4ebe18eb8b
commit
48af02684f
|
@ -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"
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue