-
Notifications
You must be signed in to change notification settings - Fork 1
/
bb.edn
77 lines (67 loc) · 3.14 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
{:min-bb-version "0.4.0"
:tasks
{:init (do
;; add any dev aliases (as keywords) you want included when starting the fe and be repls.
(def dev-aliases [])
(defn rm-rf [x] (if (fs/directory? x) (fs/delete-tree x) (fs/delete x)))
(defn rm-all [xs]
(let [xs (filter fs/exists? xs)]
(if (seq xs)
(do
(println "Removing:" (str/join ", " (map (fn [x] (str "'" x "'")) xs)))
(run! rm-rf xs))
(println "Nothing to clean."))))
(defn run-shadow
([mode builds] (run-shadow mode builds nil))
([mode builds aliases]
(shell
(cond-> (str "yarn run shadow-cljs " mode " " (str/join " " (cond-> builds (not (coll? builds)) vector)))
(seq (cond-> aliases (and aliases (not (coll? aliases))) vector))
(str " -A" (str/join aliases))))))
(def run-shadow-watch (partial run-shadow 'watch))
(def run-shadow-release (partial run-shadow 'release))
(def run-shadow-compile (partial run-shadow 'compile))
(defn write-html [file script]
(spit file
(str "<!doctype html>\n<html>\n <head><meta charset=\"utf-8\"></head>\n"
" <body>\n <div id=\"app\"></div>\n <script charset=\"utf-8\" src=\"" script
"\"></script>\n </body></html>\n")))
(defn write-example-html [module]
(fs/create-dirs (fs/file "public" module))
(write-html (fs/file "public" module "index.html") (str/join "/" ["/js" (str module ".js")]))))
:requires ([babashka.process :as p :refer [process]]
[babashka.fs :as fs]
[clojure.string :as str])
yarn-install
(shell "yarn install")
write-example.html
(do
(write-example-html "hooks-example")
(write-example-html "fulcro-example")
(write-example-html "reagent-datascript-example"))
dev
{:depends [yarn-install write-example.html]
:doc "Starts a shadow-cljs watch on the dev build"
:task (do (println "Starting shadow-cljs compilations")
(run-shadow-watch '[test reagent-datascript-example fulcro-example hooks-example]
(into *command-line-args* dev-aliases)))}
test
{:depends [yarn-install]
:task (run-shadow-watch '[test] (into *command-line-args* dev-aliases))}
cljs-test
{:depends [yarn-install]
:task
(do
(shell "yarn run shadow-cljs compile ci-tests")
(shell "./node_modules/.bin/karma start --single-run"))}
clj-test
{:task
(do
(println "Running XTDB EQL tests")
(clojure "-M:dev:test:run-tests :xtdb-eql --reporter documentation")
(println "Running Datalevin EQL tests")
(clojure "-M:dev:test:run-tests :datalevin-eql --reporter documentation")
(println "Running Fulcro EQL tests")
(clojure "-M:dev:test:run-tests :fulcro-eql --reporter documentation")
(println "Running Core tests")
(clojure "-M:dev:test:run-tests :core --reporter documentation"))}}}