-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·77 lines (55 loc) · 1.43 KB
/
build.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
75
76
77
#!/bin/bash
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-s|--start_junior)
start_junior="$2"
shift # past argument
shift # past value
;;
-c|--copy_files)
copy_files="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
#echo $start_junior
if hash node 2>/dev/null; then
echo "Nodejs is installed. "
else
echo "Nodejs is not installed"
echo "Trying to install it automatically"
echo "curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -"
echo "sudo apt-get install -y nodejs"
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
if [ ! -d "./node_modules" ]; then
echo "First start. Installing depedencies..."
npm install
fi
echo 'npm run build'
npm run build
echo 'rm app.bundle.js'
rm app.bundle.js
echo 'rm app.bundle.js.map'
rm app.bundle.js.map
echo 'cp ./src/build/bundles/app.bundle.js ./'
cp ./src/build/bundles/app.bundle.js ./
echo 'cp ./src/build/bundles/app.bundle.js.map ./'
cp ./src/build/bundles/app.bundle.js.map ./
if [[ "$copy_files" = true ]]; then
node build.js
fi
if [[ "$start_junior" = true ]]; then
echo 'npm run start'
npm run start
fi