-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
bb.edn
66 lines (57 loc) · 1.9 KB
/
bb.edn
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
{:deps {org.babashka/http-server {:mvn/version "0.1.11"}
org.babashka/cli {:mvn/version "0.2.23"}
io.github.clj-kondo/clj-kondo-bb
{:git/tag "v2023.01.20" :git/sha "adfc7df"}}
:tasks
{:requires ([babashka.cli :as cli])
:init
(do (def cli-opts
(cli/parse-opts *command-line-args* {:coerce {:port :int}}))
(defn X [cmd]
(let [args *command-line-args*]
(if (even? (count args))
(apply shell cmd args)
(do (println "Please supply an even number of arguments!")
(System/exit 1))))))
clerk-watch
{:doc "Runs `user/serve!` with a watcher process generating custom JS."
:task (X "clojure -X:nextjournal/clerk user/serve!")}
build-static
{:doc "Generate a fresh static build."
:task
(apply shell
"clojure -X:nextjournal/clerk"
*command-line-args*)}
serve
{:doc "Serve static assets"
:requires ([babashka.http-server :as server])
:task (server/exec
(merge {:port 8080
:dir "public/build"}
cli-opts))}
release-gh-pages
{:doc "Generate a fresh static build and release it to Github Pages."
:task
(do (shell "rm -rf public/build")
(run 'build-static)
(shell "npm run gh-pages"))}
publish-local
{:doc "Generate a fresh static build and start a local webserver."
:task
(do (run 'build-static)
(run 'serve))}
release
{:doc "Release the library to Clojars."
:task (shell "clojure -T:build publish")}
lint-deps
{:requires ([clj-kondo.core :as kondo])
:doc "Lint dependencies."
:task (kondo/run!
{:lint [(with-out-str
(babashka.tasks/clojure
"-Spath -A:nextjournal/clerk"))]
:dependencies true})}
lint
{:doc "Lint the src and dev directories with clj-kondo."
:task (exec 'clj-kondo.core/exec)
:exec-args {:lint ["src" "dev"]}}}}