-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
63 lines (56 loc) · 1.39 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
#!/bin/bash
TARNAME=""
ISTAR=false
start() {
while [ ${#} -gt 0 ]; do
case "${1}" in
--tar)
ISTAR=true
TARNAME=$2
shift
;;
*)
echo "${red}Unknown parameter : $1${plain}"
return 1
shift
;;
esac
shift 1
done
}
buildSource () {
echo
echo "正在编译 API 代码 ..."
echo
cd api-server && yarn build
cd ..
sleep 5
echo
echo "正在编译 WEB 代码 ..."
echo
cd web-server && yarn build
cd ..
sleep 5
if [[ $ISTAR == true ]]; then
mkdir -p .deploy
[[ $TARNAME == '' ]] && TARFILE="playground.tar.gz" || TARFILE="$TARNAME.tar.gz"
rm -rf .deploy/export
mkdir -p .deploy/export/api-server
cp -R ./api-server/channels/ ./.deploy/export/api-server/channels/
cp -R ./api-server/config/ ./.deploy/export/api-server/config/
cp -R ./api-server/mails/ ./.deploy/export/api-server/mails/
cp -R ./api-server/views/ ./.deploy/export/api-server/views/
cp -R ./api-server/dist/ ./.deploy/export/api-server/dist/
cp ./api-server/package.json ./.deploy/export/api-server/
mkdir -p .deploy/export/web-server
cp -R ./web-server/.output/ ./.deploy/export/web-server/.output/
cp ./docker/web-server/package.json ./.deploy/export/web-server/
cp ./Makefile ./.deploy/export/
cd ./.deploy/export
tar -czvf $TARFILE .
sleep 5
echo "Done!"
fi
}
start "${@:1}"
buildSource