-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
65 lines (49 loc) · 1.77 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
64
#!/bin/bash
ENV=$1
set -e
function echoYellow() {
MSG=$1
printf "\033[1;33m$MSG\033[0m\n"
}
echo
echoYellow "|--------------------------------------------------------|"
echoYellow "| Building the application with Bash and Webpack |"
echoYellow "|--------------------------------------------------------|\n"
#if [ "$ENV" == "dev" ]; then
# export NODE_ENV=development
#else
# export NODE_ENV=production
#fi
#echoYellow " 1. Cleaning up & copying files"
echoYellow " 1. Copying files"
# Removing the dist folder. Important for development environement.
#if [ -d ./dist ]; then
# echoYellow " -> Removing all files from the /dist folder"
# rm -rf ./dist/*
#fi
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
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
if [ "$ENV" == "docker" ]; then
echo
echoYellow " 2. Bundling the client app into the /dist folder to list results\n"
WEBPACK_ENV=dev WEBPACK_MODE=build webpack
fi