-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.sh
executable file
·69 lines (58 loc) · 1.35 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
#!/bin/bash
echo "$(date +"[%T.%3N]") Evaluate Options... "
buildBackend='false'
buildFrontend='false'
forceFrontend='false'
if [[ $1 == "-h" ]]; then
printf "Usage: build.sh [-h] [-b] [-ff] [-f]\n\n"
echo "Options:"
echo " -b Build Backend"
echo " -ff Remove yarn.lock"
echo " -f Build Frontend"
exit 0
fi
if [[ "$1" == "" ]]; then
buildBackend='true'
buildFrontend='true'
fi
if [[ ${#1} -gt 2 ]]; then
if [[ "$1" == -*"b"* ]]; then
buildBackend='true'
fi
if [[ "$1" == -*"f"* ]]; then
buildFrontend='true'
fi
if [[ "$1" == -*"ff"* ]]; then
forceFrontend='true'
fi
fi
while [ "$1" != "" ]; do
case $1 in
-b | --backend ) buildBackend='true'
;;
-f | --frontend ) buildFrontend='true'
;;
-ff | --forcefrontend ) forceFrontend='true'
;;
esac
shift
done
[[ "$buildBackend" == "true" ]] && echo " Build Backend (-b)"
[[ "$forceFrontend" == "true" ]] && echo " Remove yarn.lock (-ff)"
[[ "$buildFrontend" == "true" ]] && echo " Build Frontend (-f)"
if [ "$buildBackend" == "true" ]; then
echo "$(date +"[%T.%3N]") Build backend products"
cd server/
mvn clean install -U
cd ../
fi
if [ "$forceFrontend" == "true" ]; then
cd client/
rm -f ./yarn.lock
cd ..
fi
if [ "$buildFrontend" == "true" ]; then
cd client/
yarn
cd ..
fi