generated from KTH/node-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·47 lines (35 loc) · 1.32 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
#!/bin/bash
ENV=$1
function echoYellow() {
MSG=$1
printf "\033[1;33m$MSG\033[0m\n"
}
echo
echoYellow "|--------------------------------------------------------|"
echoYellow "| Building the application with Bash and Webpack |"
echoYellow "|--------------------------------------------------------|\n"
echoYellow " 1. Copying files"
# echoYellow " -> Creating the server view folders"
# mkdir -p ./server/views/system ./server/views/layouts
# echoYellow " -> Copying error.handlebars to server/views/system folder"
# cp -R ./node_modules/@kth/kth-node-web-common/lib/handlebars/pages/views/. server/views/system
# echoYellow " -> Copying errorLayout.handlebars to server/views/layouts folder"
# cp -R ./node_modules/@kth/kth-node-web-common/lib/handlebars/pages/layouts/. server/views/layouts
if [ "$ENV" == "prod" ]; then
echo
echoYellow " 2. Bundling the client app into the /dist folder\n"
WEBPACK_ENV=prod WEBPACK_MODE=build webpack
if [ $? -ne 0 ]; then
exit 1
fi
echo
echoYellow " Done.\n"
fi
if [ "$ENV" == "dev" ]; then
echo
echoYellow " 2. Bundling the client app into the /dist folder to list results\n"
WEBPACK_ENV=dev WEBPACK_MODE=build webpack
echo
echoYellow " 3. Running watch on client app. Check /dist for changes\n"
WEBPACK_ENV=dev WEBPACK_MODE=watch webpack
fi