-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
executable file
·64 lines (52 loc) · 1 KB
/
go
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
#!/usr/bin/env bash
set -e -o pipefail
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd -P)
_npm() {
if [ -z "${CI:-}" ] ; then
n exec auto npm "$@"
else
npm "$@"
fi
}
goal_linter-js() {
_npm run linter:js
}
goal_linter-css() {
_npm run linter:css
}
goal_test-js() {
_npm test
}
goal_run() {
_npm run start
}
goal_build() {
DISABLE_ESLINT_PLUGIN=true _npm run build
}
goal_all() {
goal_linter-js
# goal_linter-css
CI=t goal_test-js
goal_build
}
validate-args() {
acceptable_args="$(declare -F | sed -n "s/declare -f goal_//p" | tr '\n' ' ')"
if [[ -z $1 ]]; then
echo "usage: $0 <goal>"
# shellcheck disable=SC2059
printf "\n$(declare -F | sed -n "s/declare -f goal_/ - /p")"
exit 1
fi
if [[ ! " $acceptable_args " =~ .*\ $1\ .* ]]; then
echo "Invalid argument: $1"
# shellcheck disable=SC2059
printf "\n$(declare -F | sed -n "s/declare -f goal_/ - /p")"
exit 1
fi
}
CMD=${1:-}
shift || true
if validate-args "${CMD}"; then
"goal_${CMD}"
exit 0
fi