-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathnode_deps.sh
executable file
·50 lines (46 loc) · 1.34 KB
/
node_deps.sh
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
46
47
48
49
50
#!/bin/zsh
# This script only works if the previous deps_part1.sh is ran successfully.
# Author: Hemant Joshi
bold=$(tput bold)
# Installing node
printf "\n${bold}Node.JS (Only v15 supported as of now)\n"
printf "Refer here for more details: https://github.com/nvm-sh/nvm/issues/2350\n"
. ~/.nvm/nvm.sh
nvm > /dev/null
if [ $? -eq 0 ]; then
printf "NVM Already installed... Proceeding further...\n"
node -v
if ! [ $? -eq 0 ]; then
nvm install node
check_install_result "Node.JS v15"
nvm use node
fi
else
download=$(curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | zsh)
printf "$download"
check_install_result "NVM"
`export NVM_DIR="$HOME/.nvm"`
`[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"`
`[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"`
. ~/.nvm/nvm.sh
nvm
if [ $? -eq 0 ]; then
node_latest=$(nvm install node)
printf "$node_latest"
check_install_result "Node.JS v15"
nvm use node
else
printf "\nSomething went wrong... Please try installing again...\n"
fi
fi
node -v
if [ $? -eq 0 ]; then
yarn -v
if ! [ $? -eq 0 ]; then
npm install -g yarn
else
printf "\n${bold}Yarn installed\n"
fi
else
printf "${bold}Node.JS is not installed. Please try again..."
fi