forked from babashka/nbb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbb.edn
53 lines (45 loc) · 2.02 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
{:paths ["script"]
:tasks
{:requires ([babashka.fs :as fs]
[cheshire.core :as json])
:init (do (def ^:dynamic *test* (= "true" (System/getenv "NBB_TESTS")))
(defn wrap-tests [cmd]
(if *test*
(str cmd " --aliases :test --config-merge shadow-tests.edn")
cmd)))
clean (fs/delete-tree "out")
compile (shell (wrap-tests "npx shadow-cljs --force-spawn compile modules"))
watch (shell "npx shadow-cljs --force-spawn watch modules")
run-tests (shell "node out/nbb_tests.js")
release {:depends [clean]
:task
(do (apply shell (wrap-tests "npx shadow-cljs --force-spawn release modules") *command-line-args*)
(spit "out/nbb_core.js"
(clojure.string/replace (slurp "out/nbb_core.js") (re-pattern "self") "globalThis"))
(spit "out/nbb_main.js"
(str "#!/usr/bin/env node\n\n" (slurp "out/nbb_main.js")))
(shell "chmod +x out/nbb_main.js")
(run! fs/delete (fs/glob "out" "**.map")))}
run-integration-tests nbb-tests/main
bump-version (do (shell "npm version patch")
(shell "git push")
(shell "git push origin"
(str "v" (:version (json/parse-string (slurp "package.json") true)))))
publish (shell "npm publish")
ci:test {:doc "Runs all tests in CI."
:task (binding [*test* true]
(println "Testing optimizations :none")
(run 'clean)
(run 'compile)
(run 'run-tests)
(run 'run-integration-tests)
(println "Testing optimizations :advanced")
(run 'clean)
(run 'release)
(run 'run-tests)
(run 'run-integration-tests))}
ci:publish {:doc "Publishes to npm after tests pass."
:task
(binding [*test* false]
(run 'release)
(run 'publish))}}}