forked from Wolox/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·74 lines (59 loc) · 2 KB
/
run.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
echo "Getting initial dependencies..."
system_has() {
type "$1" > /dev/null 2>&1
}
currentnodeversion="$(node --version)"
requirednodeversion="v10.15.3"
currentnpmversion="$(npm --version)"
requirednpmversion="6.9.0"
while getopts ":vl" opt; do
case $opt in
v) verbose="-v"
;;
l) local="true"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
if ! system_has git; then
echo "git is mandatory to continue"
echo "Check this guide to complete the installation: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"
exit 1
elif [ "$(printf '%s\n' "$requirednodeversion" "$currentnodeversion" | sort -V | head -n1)" != "$requirednodeversion" ]; then
echo "The node version must be >= v10.15.3"
exit 1
elif [ "$(printf '%s\n' "$requirednpmversion" "$currentnpmversion" | sort -V | head -n1)" != "$requirednpmversion" ]; then
echo "The npm version must be >= v6.9.0"
exit 1
fi
printf "\n\nThis script requires an npm configuration that allows global\n"
printf "installs without sudo. We'll be checking whether you have globally\n"
printf "installed packages and if so, we'll be moving them to a new folder.\n\n"
printf "You may have to type in your password once to allow moving all\n"
printf "your currently installed packages.\n\n"
if [[ -n "$verbose" ]]
then
curl -s https://raw.githubusercontent.com/Wolox/react-bootstrap/development/scripts/npm-no-sudo.sh | bash -s -- -v
npm i -g yo generator-react-bootstrap
else
bash <(curl -s https://raw.githubusercontent.com/Wolox/react-bootstrap/development/scripts/npm-no-sudo.sh)
npm i -g yo generator-react-bootstrap > /dev/null 2>&1
fi
yo --version
if [ $? -eq 0 ]; then
echo Yeoman installed
else
echo Yeoman not installed, installing now...
npm install -g yo
fi
if [[ "$local" == "true" ]]
then
yo ./react-bootstrap/generators/app $verbose
else
yo react-bootstrap $verbose
fi
wait $!
} # this ensures the entire script is downloaded #