mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-18 03:00:11 +00:00
23 lines
526 B
Text
23 lines
526 B
Text
|
#!/bin/bash
|
||
|
set +e
|
||
|
|
||
|
function __install_nvm {
|
||
|
curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh >/dev/null | bash
|
||
|
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
|