-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile
executable file
路83 lines (66 loc) 路 1.84 KB
/
Taskfile
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
#!/bin/bash
NODE_MODULES_BIN="./node_modules/.bin"
function __show_tasks {
compgen -A function | grep -v "^_"
}
function _logger {
local d=$(date --rfc-3339=ns)
echo -ne "$d\t$@\n"
}
function _concat-js {
outfile=${1:-gorilla.js}
outdir=${2:-dist}
cat src/gorilla.js src/gorilla/*.js > "$outdir/$outfile"
}
function _concat-shims {
cat lib/es-shims/promise.min.js \
> "tmp/shims.js"
}
function _minify-js {
infile=${1:-gorilla.js}
outfile=${2:-gorilla.min.js}
$NODE_MODULES_BIN/babel-minify dist/"$infile" --out-file dist/"$outfile"
}
function build {
_concat-js
_minify-js
}
function build-compat {
_concat-js "gorilla.js" "tmp"
_concat-shims
cat tmp/shims.js tmp/gorilla.js > tmp/gorilla.shimmed.js
$NODE_MODULES_BIN/babel tmp/gorilla.shimmed.js --out-file dist/gorilla.compat.js
_minify-js "gorilla.compat.js" "gorilla.compat.min.js"
}
function build-all {
build && build-compat
}
function watch {
local watchdir="./src/"
_logger "Watcher started"
inotifywait -m -r -e close_write --format '%w%f' "${watchdir}" | \
while read events; do
_logger "Build triggered"
Task build
_logger "Build finished"
done
}
function dirty-deploy {
scp -r dist/* root@superevilmegaco.com:/www/gorilla.moe/cdn/htdocs/gorilla.js/dist/
}
function deploy {
ssh root@superevilmegaco.com "cd /www/gorilla.moe/cdn/htdocs/gorilla.js/ && git pull origin master"
}
function start-server {
# https://github.com/zeit/serve
$NODE_MODULES_BIN/serve dist
}
function clean {
rm -rf ./dist/*
}
function help {
echo "$0 <task> <args>"
echo "Tasks:"
__show_tasks | cat -n
}
${@:-tasks}