-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
48 lines (42 loc) · 982 Bytes
/
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
#!/bin/bash
case "$1" in
"-build")
#update backend
cd backend
git pull
if [[ -v $2 ]] && [[ $2 -eq "-install" ]]
then
npm install
fi
#build docs for backend
cp ./README.md ./tutorials
rm -rf ./documentation
./node_modules/jsdoc/jsdoc.js -c jsdoc-conf.json api/*
#update frontend
cd ../frontend
git pull
if [[ -v $2 ]] && [[ $2 -eq "-install" ]]
then
npm install
fi
#build docs for frontend
compodoc -p tsconfig.json
;;
"-launch")
#Build frontend, then remove current prod directory, then replace with newly built one, then restart pm2 process for backend
cd frontend
ng build --prod
rm -rf dist
mkdir dist
shopt -s dotglob
cp -r dist-includes/dist/* dist/
cp dist-includes/* dist/
cd ../backend
npm run db-migrate
pm2 gracefulReload app.js
;;
*)
echo "Specify -build or -launch"
exit 1
;;
esac