-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·69 lines (58 loc) · 1.18 KB
/
compile.sh
File metadata and controls
executable file
·69 lines (58 loc) · 1.18 KB
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
69
#!/bin/sh
CHK_PHP=$(which php 2>/dev/null)
if [ ! -z "$CHK_PHP" ]; then
conf=`DUMP=cli php -r "include('config/config.php');"`
else
conf='{'
conf+='"assetsRoot":"./assets/",'
conf+='"devPort": "'${hotPort:-8080}'"'
conf+='}'
fi
echo $conf;
webpack='npm run webpack --'
production(){
echo "Production Mode";
npm run build
NODE_ENV=production CONFIG=$conf $webpack
NODE_ENV=production CONFIG=$conf $webpack --config webpack.server.js
}
develop(){
echo "Develop Mode";
npm run build
CONFIG=$conf $webpack
CONFIG=$conf $webpack --config webpack.server.js
}
killBy(){
ps -eo pid,args | grep $1 | grep -v grep | awk '{print $1}' | xargs -I{} kill -9 {}
}
stop(){
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
killBy ${DIR}/node_modules/.bin/babel
cat webpack.pid | xargs -I{} kill -9 {}
npm run clean
}
watch(){
echo "Watch Mode";
npm run build:cjs:ui -- --watch &
npm run build:cjs:src -- --watch &
npm run build:es:ui -- --watch &
npm run build:es:src -- --watch &
}
case "$1" in
watch)
stop
watch
;;
stop)
stop
;;
p)
stop
production
;;
*)
stop
develop
exit
esac
exit $?