-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·45 lines (36 loc) · 1.21 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -e
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pushd "${BASEDIR}" >/dev/null
echo "-- Installing submodules"
git submodule update --init --recursive
echo "-- Installing dotbot"
./install-dotbot
if [[ $OSTYPE == darwin* ]]; then
echo "-- Running OSX install script"
pushd osx >/dev/null
./osx-install.sh;
popd >/dev/null # osx
fi
if ! command -v nvm >/dev/null 2>&1; then
echo "-- Installing nvm"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi
echo "-- Installing/updating node"
nvm install node
if [ -f "${BASEDIR}/npm-packages" ]; then
echo "-- Installing/upgrading npm packages"
INSTALLED_NPM_MODULES=$(npm ls -g --depth=0)
OUTDATED_NPM_MODULES=$(npm outdated -g --depth=0)
while read -u 30 p; do
if ! echo "${INSTALLED_NPM_MODULES}" | grep -q " ${p}@"; then
npm install -g ${p}
elif echo "${OUTDATED_NPM_MODULES}" | grep -q "^${p}\s"; then
npm update -g ${p}
fi
done 30<"${BASEDIR}/npm-packages"
fi
popd >/dev/null # "${BASEDIR}"