dotfiles/recipes/nvm

23 lines
515 B
Text
Raw Normal View History

2018-02-22 04:15:49 +00:00
#!/bin/bash
2018-02-27 05:15:14 +00:00
set -e
2018-02-22 04:15:49 +00:00
function __install_nvm {
2018-02-23 21:18:11 +00:00
curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
2018-02-22 04:15:49 +00:00
source ~/.nvm/nvm.sh
nvm install node 2>/dev/null
nvm alias default node
}
function _npm {
local pkg=$1
if ! npm list -g $pkg >/dev/null; then
_run "[npm] Install $pkg" npm install --no-progress -g $@
else
echo "[npm] $pkg is already installed, skipping."
fi
}
if ! [ -f ~/.nvm/nvm.sh ]; then
_run "Install nvm" __install_nvm
fi