-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.sh
executable file
·85 lines (66 loc) · 1.31 KB
/
app.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env sh
set -e
# tests - run frontend tests
tests() {
yarn --cwd ./web/ test
}
start() {
yarn --cwd ./web/ --no-progress --non-interactive install
yarn --cwd ./web/ --no-progress --non-interactive serve
}
build() {
yarn --cwd ./web/ --frozen-lockfile --no-progress --non-interactive build &> /dev/null
}
# clean - remove temporary building directories
clean() {
rm -rf ./dist
}
# =========================================================== #
me() {
echo "./$(basename "$0")"
}
USAGE=$(
cat <<-END
$(me) - starts application
NAME
./app - entrypoint for control
USAGE
$(me) command sub-command
COMMANDS
test - run tests for application
start - start web application
build - build frontend and collect
results into ./dist directory.
clean - drop build directory
END
)
# ==== entrypoint =========================================== #
if [ ! -d ".git" ]; then
echo "Script must be starts from root project directory"
echo "We detect .git directory for checking that)"
echo
exit 1
fi
case $1 in
t |test)
tests
;;
s | start)
start
;;
b | build)
build
;;
h | help | "")
echo "$USAGE"
;;
c | clean)
clean
;;
*)
echo "$1 command does not exists, check help or usage"
echo
exit 1
;;
esac
echo