-
Notifications
You must be signed in to change notification settings - Fork 27
/
initial_setup.sh
executable file
·45 lines (40 loc) · 1.39 KB
/
initial_setup.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
#!/bin/bash
if [ -d "frog/node_modules" ]; then
echo "Please run git clean -fdx before running initial_setup.sh"
exit 0
fi
shopt -s dotglob
if ! PYTHON_VERSION=$(python --version);
then
echo "Cannot find Python, please install Python 2 and try again"
exit 1
fi
if ! python -c 'import sys; print(sys.version_info[0] == 2)' > /dev/null == 'True';
then
echo "Cannot find Python 2, Please install Python 2 and try again"
exit 1
fi
YARN_VERSION='1.22.0'
if which yarn && [[ `yarn --version` == $YARN_VERSION ]]; then
echo 'Using pre-installed global Yarn'; YARN=yarn
else
if [ -f "./node_modules/.bin/yarn" ] && [[ `./node_modules/.bin/yarn --version` == $YARN_VERSION ]]; then
echo 'Using pre-installed local Yarn'; YARN="./node_modules/.bin/yarn"
else
echo 'Installing Yarn'; npm install yarn@$YARN_VERSION --no-package-lock && YARN="./node_modules/.bin/yarn"
fi
fi
echo "Yarn: $YARN"
if ! "$YARN" install; then
echo "Sorry, there seems to be something wrong, please correct the errors and try again"
echo "There was some error installing the required packages, please rectify the errors and try again"
exit 1
fi
rm -rf frog/node_modules
ln -s `pwd`/node_modules frog
ln -s frog/babel.config.js .
node linkFiles.js
echo
echo -e "\xE2\x9C\xA8 Finished Initial Setup."
echo -e "\xF0\x9F\xA4\x93 Run ${LBLUE}npm start server ${NC}to begin hacking!"
exit 0