mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-23 03:00:08 +00:00
23 lines
560 B
Bash
23 lines
560 B
Bash
#!/bin/bash
|
|
# Description: Javascript version management
|
|
set -e
|
|
|
|
function __install_nvm {
|
|
curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | 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
|