-
Notifications
You must be signed in to change notification settings - Fork 0
/
bb.edn
122 lines (91 loc) · 5.39 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
;; initial outline from https://github.com/babashka/http-server/blob/main/bb.edn
{:pods {}
:deps { local/deps {:local/root "."}}
; io.github.borkdude/gh-release-artifact {:git/sha "cf082df46a648178d1904e9cbcb787d8136a35c6"}
:paths ["src/bb" "src/main/clj"]
:tasks {:requires [[babashka.cli :as cli]
[clojure.string :as s]
[clojure.pprint :refer [pprint]]]
:init (do
(defn shell-x [cmd opts]
(println cmd)
(println "options:")
(pprint opts)
(apply shell cmd (apply concat opts)))
(defn shell-cmd [& args]
(let [cmd (s/join " " args)]
(println cmd)
(apply shell args))))
clerk-notebooks "src/clerk/notebooks"
clj-src-path "src/main/clj"
clj-test-path "src/test/clj"
git-repo (str "https://github.com/" "davesann/let-map")
clean {:requires [[babashka.fs :as fs]]
:task (do
;; nrepl things
(fs/delete-if-exists ".nrepl-port")
;; clojure things
(fs/delete-tree ".cpcache")
;; cljs testing things
(fs/delete-tree "cljs-test-runner-out")
;; cljs npm and node things
(fs/delete-tree ".shadow-cljs")
(fs/delete-tree "node_modules")
(fs/delete-if-exists "package-lock.json")
(fs/delete-if-exists "package.json")
;; clerk things
(fs/delete-tree ".clerk"))}
quickdoc {:extra-deps {io.github.borkdude/quickdoc {:git/sha "32e726cd6d785d00e49d4e614a05f7436d3831c0"}}
:doc "Invoke quickdoc"
:depends [clj-src-path git-repo]
:requires ([quickdoc.api :as api])
:task (api/quickdoc {:toc true
:git/branch "main"
:github/repo git-repo
:source-paths [clj-src-path]})}
ppcp {:doc "Pretty print the classpath - add (run 'ppcp) in a task to see it's classpath"
:requires [[babashka.classpath :refer [get-classpath]]
[clojure.string :as s]
[clojure.pprint :refer [pprint]]]
:task (-> (get-classpath)
(s/split (re-pattern ":"))
pprint)}
nrepl {:doc "run an nrepl server"
:task (shell-cmd "clojure -M:nrepl-deps:repl-deps:test-deps:clerk-deps"
"-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]")}
clerk-watch {:doc "Run clerk and watch for changes"
:depends [clj-src-path clerk-notebooks]
:task (let [;cmd "clojure -X:clerk nextjournal.clerk/serve!"
cmd "clojure -X:clerk-deps dsann.clerk.init/serve!"
default-opts {:watch-paths [clj-src-path clerk-notebooks]
:port 8888
:browse? true}
cli-opts (cli/parse-opts *command-line-args* {:coerce {:port :int}})
opts (merge default-opts cli-opts)]
(shell-x cmd opts))}
test-clj-once {:doc "invoke clojure tests"
:task (shell "clojure -M:test-clj:test-deps")}
test-clj {:doc "invoke clojure tests and watch"
:task (shell "clojure -M:test-clj:test-deps --watch --fail-fast --no-randomize")}
test-cljs-once {:doc "invoke clojurescript tests once"
:depends [clj-test-path]
:task (shell "clojure -M:test-cljs:test-deps" "-d" clj-test-path)}
test-cljs {:doc "invoke clojurescript tests and watch"
:depends [clj-src-path clj-test-path]
:task (shell "clojure -M:test-cljs:test-deps" "-d" clj-test-path "-w" clj-src-path)}
git-data {:extra-deps {io.github.davesann/bb-git-local {:git/tag "v2" :git/sha "fd4debc"}}
:requires [[dsann.bb.git :as g]]
:task (g/git-data)}
create-git-data {:depends [git-data]
:requires [[clojure.pprint :refer [pprint]]]
:task (binding [*print-namespace-maps* false]
(spit "gen/git-data.edn"
(with-out-str (pprint git-data))))}
create-readme {:doc "Generate README File"
:depends [git-data]
:extra-deps {comb/comb {:mvn/version "0.1.1"}}
:requires [[comb.template :as comb]]
:task (binding [*print-namespace-maps* false]
(let [readme (slurp "src/docs/README.comb.md")]
(spit "README.md" (comb/eval readme git-data))))}}}
; package-jar {:doc "Prepare jar for packages"