-
Notifications
You must be signed in to change notification settings - Fork 1
/
re-css.sh
executable file
·90 lines (79 loc) · 1.66 KB
/
re-css.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
86
87
88
89
90
#!/usr/bin/env bash
set -euo pipefail
cd "$(realpath "$(dirname "$0")")"
if [[ ! -f project.sh ]];then
curl -OL https://raw.githubusercontent.com/jesims/backpack/master/project.sh
fi
if ! source project.sh;then
exit 1
fi
ensure_githooks () {
local githooks_folder="githooks"
if [[ "$(git config core.hooksPath)" != "$githooks_folder" ]];then
echo "Setting up GitHooks"
git config core.hooksPath "$githooks_folder"
fi
}
ensure_npm_deps () {
if [[ ! -d 'node_modules/karma' ]]; then
echo "Installing node modules"
npm install
fi
}
shadow-cljs () {
lein trampoline run -m shadow.cljs.devtools.cli "$@"
}
## deps:
## Installs Dependencies
deps () {
echo_message 'Installing dependencies'
npm install
lein deps
}
## clean:
## Cleans the working project folder of generated and cached files
clean () {
echo_message 'Cleaning'
rm -rf resources/public/js/ .shadow-cljs/ .cpcache target/*
}
## build:
## Builds the project for release
build () {
echo_message 'Building'
shadow-cljs release app --source-maps
}
## test:
## args: [-r]
## Runs the unit tests
## [-r] in browser, watching for changes
test () {
if [[ -z "${1-}" ]];then
echo_message 'Running Tests Once'
shadow-cljs compile test
npx karma start --single-run
else
echo_message 'Watching Tests'
shadow-cljs watch test-browser
fi
}
## lint:
## Lints the Clojure source files
lint () {
echo_message 'Linting'
lein cljfmt check
}
## format:
## Formats the Clojure and markdown source files
format () {
echo_message 'Formatting'
lein cljfmt fix
npx remark . \
--use preset-github \
--use toc \
--use bookmarks -o
}
if ! ${CI:-false};then
ensure_githooks
ensure_npm_deps
fi
script-invoke "$@"