-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild_client
executable file
·64 lines (48 loc) · 1.56 KB
/
build_client
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
#! /bin/bash
bold=$(tput bold)
dim=$(tput dim)
noformat=$(tput sgr0)
echo ""
echo "${dim}====================================${noformat}"
echo " Building Client Web App (WebPack)"
echo "${dim}====================================${noformat}"
echo ""
echo "=== Removing previous client build files (if any)"
echo ""
# Remove old files
if [ -a ./python/loom_viewer/static/ ]; then
rm -rv ./python/loom_viewer/static/
fi
set -o nounset
set -o errexit
echo ""
echo " Done"
echo ""
# Build static assets
echo ""
if [ "${1:-dev}" == "dev" ]; then
echo "=== Run WebPack with development build"
echo ""
webpack --config='webpack.config.dev.js' --progress --profile --colors --mode=development
# I haven't figured out how to both generate correct paths in the webpack HTML
# template, and have the resulting index.html be put in the right folders.
# Yes, this is an ugly hack around my incompetence, but it works - Job
mv ./python/loom_viewer/index.html ./python/loom_viewer/static/index.html
cp ./client/images/favicon.ico ./python/loom_viewer/static/favicon.ico
echo ""
echo " Done"
echo ""
elif [ "${1:-dev}" == "prod" ]; then
echo "=== Run WebPack with production build"
echo ""
webpack --config='webpack.config.prod.js' --progress --profile --colors --mode=production
mv ./python/loom_viewer/index.html ./python/loom_viewer/static/index.html
cp ./client/images/favicon.ico ./python/loom_viewer/static/favicon.ico
echo ""
echo " Done"
echo ""
else
echo " ${bold}ERROR: Incorrect flags passed for WebPack build${noformat}"
echo ""
exit 1
fi