forked from babashka/scittle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bb.edn
74 lines (61 loc) · 3.04 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
{:deps {io.github.babashka/sci.nrepl
#_{:local/root "../sci.nrepl"}
{:git/sha "2f8a9ed2d39a1b09d2b4d34d95494b56468f4a23"}
io.github.babashka/http-server
{:git/sha "b38c1f16ad2c618adae2c3b102a5520c261a7dd3"}
io.github.scittle/build
{:local/root "build"}}
:tasks
{:requires ([scittle.build :as build]
[babashka.fs :as fs]
[cheshire.core :as json]
[babashka.process :as p :refer [process]])
clean {:doc "Start from clean slate."
:task (do (run! fs/delete (fs/list-dir (fs/file "resources" "public" "js") "**.*"))
(fs/delete-tree ".cpcache")
(fs/delete-tree ".shadow-cljs"))}
shadow:watch {:doc "Development build. Starts webserver and watches for changes."
:task (build/build {:action "watch"
:args *command-line-args*})}
http-server {:doc "Starts http server for serving static files"
:requires ([babashka.http-server :as http])
:task (do (http/serve {:port 1341 :dir "resources/public"})
(println "Serving static assets at http://localhost:1341"))}
browser-nrepl {:doc "Start browser nREPL"
:requires ([sci.nrepl.browser-server :as bp])
:task (bp/start! {})}
-dev {:depends [shadow:watch browser-nrepl http-server]}
dev {:doc "Development build. Starts webserver and watches for changes."
:task (do (run '-dev {:parallel true})
(deref (promise)))}
prod {:doc "Builds production artifacts."
:task (build/build {})
:depends [clean]}
dist {:doc "Prepare dist folder for npm package"
:depends [prod]
:task (do
(fs/delete-tree "dist")
(fs/create-dirs "dist")
(run! (fn [f] (fs/copy f "dist"))
(fs/glob "resources/public/js" "*.js")))}
bump-version {:doc "Bumps package.json and pushes new git tag"
:task (do (shell "npm version patch")
(shell "git push --atomic origin main"
(str "v" (:version (json/parse-string (slurp "package.json") true)))))}
npm-publish {:doc "Updates NPM ibrary"
:task (do (run 'dist)
(run 'bump-version)
(shell "npm publish"))}
replace-version {:doc "Ported from bash one-liners. Expects two versions.
TODO: port to Clojure.
TODO: skip changelog.md
"
:task
(let [[prev next] *command-line-args*]
(-> (process ["bash" "-c"
(format "rg %s --files-with-matches | xargs sed -i '' 's/%s/%s/g'"
prev prev next)]
{:inherit true})
p/check))}
gh-pages {:doc "Updates Github pages with new release build."
:task (shell "script/release.clj")}}}