-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
58 lines (55 loc) · 1012 Bytes
/
make.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
#!/bin/sh
set -eu
export PATH=$(pwd)/node_modules/.bin/:$PATH
self="sh $0"
set -x
case ${1:-} in
deps)
npm install
;;
build-client)
webpack -p
;;
build-server)
mkdir -p lib/server
cd src/server
tsc
cd -
;;
serve-client)
webpack-dev-server --port 8081 --inline
;;
server)
cd src/server
exec ts-node server.ts
;;
server-dev)
export DISABLE_AUTH=1
exec nodemon --ext ts --exec sh $self server
;;
install-git-hook)
cat > .git/hooks/post-receive <<EOF
#!/bin/bash -l
set -eu
cd ..
unset GIT_DIR GIT_WORK_TREE
git reset --hard master
exec sh make.sh production-update
EOF
chmod a+x .git/hooks/post-receive
;;
production-update)
$self install-git-hook
$self
sudo systemctl restart lahjakortti
;;
"")
$self deps
$self build-client
$self build-server
;;
*)
echo "Bad task"
exit 1
;;
esac