forked from getgauge/gauge-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·55 lines (45 loc) · 1.06 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
#!/bin/bash
function checkCommand() {
command -v $1 >/dev/null 2>&1 || { echo >&2 "$1 is not installed, aborting."; exit 1; }
}
function build() {
checkCommand "npm"
npm run build
}
function test() {
checkCommand "npm"
npm test
}
function version() {
checkCommand "jq"
echo `cat ts.json | jq -r .version`
}
function package() {
checkCommand "npm"
checkCommand "zip"
rm -rf dist deploy artifacts
npm run build
cp -r ./src/gen ./dist
mkdir -p deploy
cp launcher.* deploy
cp ts.json deploy
mkdir -p artifacts
(export version=$(version) && cd deploy && zip -r ../artifacts/gauge-ts-$version.zip .)
}
function install() {
package
gauge install ts -f ./artifacts/gauge-ts-$(version).zip
}
function uninstall() {
gauge uninstall ts -v $(version)
}
function forceinstall() {
uninstall
install
}
tasks=(build test package install uninstall forceinstall)
if [[ " ${tasks[@]} " =~ " $1 " ]]; then
$1
exit 0
fi
echo Options: [build \| test \| package \| install \| uninstall \| forceinstall]