forked from hackforla/shared-housing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-local.sh
executable file
·70 lines (51 loc) · 1.4 KB
/
build-local.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
#!/bin/bash
# Helper function to call user attention to the instructions that follow
function printDoneMessage {
done_msg="BUILD COMPLETE"
msglen=${#done_msg}
cols=$(tput cols)
total_pad=`expr $cols - $msglen`
padlen=`expr $total_pad / 2`
x=0;
while [ $x -lt $cols ]; do echo -n '='; let x=$x+1; done;
x=0;
while [ $x -lt $padlen ]; do echo -n '='; let x=$x+1; done;
echo -n $done_msg;
x=0;
while [ $x -lt $padlen ]; do echo -n '='; let x=$x+1; done;
x=0;
while [ $x -lt $cols ]; do echo -n '='; let x=$x+1; done;
}
cd client
if npm install; then
if npm run build; then
echo "Client build complete.";
else
echo "Client build failed.";
exit 1;
fi
else
echo "Client failed to install dependencies.";
exit 1;
fi
cd ..
if [[ -d "server/api/templates" ]]; then
rm -rf server/api/templates
fi
if [[ -d "server/api/static" ]]; then
rm -rf server/api/static
fi
mkdir -p server/api/{templates,static}
mv client/dist/index.html server/api/templates
mv client/dist/* server/api/static
cd server
if pip install -r requirements.txt; then
echo "Server dependencies installed.";
else
echo "Server dependencies failed to install.";
exit 1;
fi
cd ..
printDoneMessage
# echo "------ BUILD COMPLETE ------"
printf "\nUse the following command to start the server:\n\n cd server/api && python run.py\n"