-
Notifications
You must be signed in to change notification settings - Fork 19
/
bb.edn
70 lines (54 loc) · 3.13 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
{:min-bb-version "0.7.6"
:paths [".bb"]
:pods {org.babashka/fswatcher {:version "0.0.4"}}
:tasks
{:requires ([clojure.edn :as edn]
[clojure.string :as str]
[babashka.deps :as deps]
[babashka.fs :as fs]
[babashka.process :as p]
[tasks :as t])
:init (do
(defn viewer-css-path []
(let [cp (str/trim (with-out-str (deps/clojure ["-A:dev:demo" "-Spath"])))]
(str/trim (:out (shell {:out :string} (str "bb -cp " cp " -e '(println (.getPath (clojure.java.io/resource \"css/viewer.css\")))'"))))))
(defn get-paths [ext]
(map str (fs/glob "." (str "{demo,src,collab}/**." (name ext))))))
copy-viewer-css {:doc "Copies viewer stylesheet to resources."
:task (fs/copy (viewer-css-path) "resources/stylesheets/viewer.css" #{:replace-existing})}
yarn-install (shell "yarn install")
clean (let [paths (get-paths :mjs)]
(println (apply str (interpose "\n" (cons "removing:" paths))))
(doseq [path paths] (fs/delete path)))
#_#_compile {:doc "Use squintjs to compile all cljs files recursively"
:depends [yarn-install]
:task (shell {:std :inherit :err :inherit}
(apply str (cons "yarn squint compile "
(interpose " " (get-paths :cljs)))))}
#_#_build {:doc "Compiles cljs files with squint and builds from mjs sources with vite"
:depends [compile]
:task (shell {:std :inherit :err :inherit}
"yarn build")}
watch-cljs (shell "yarn watch")
squint:watch-cljs (shell "yarn run squint watch")
yarn-install:squint-dev (do
(shell "yarn add squint-cljs@link:../squint")
(shell {:dir "node_modules/.bin"} "ln -sf" "../squint-cljs/node_cli.js" "squint"))
vite:dev {:doc "Launches vite application"
:depends [yarn-install]
:task (shell "yarn vite:dev")}
vite:build {:depends [yarn-install]
:task (shell "yarn vite:build")}
squint:build {:task (shell "yarn squint compile")}
publish {:depends [squint:build]
:doc "Publish to NPM, do `npm login` manually first to authenticate your shell."
:task (shell "npm publish")}
squint:demo:build {:task (do (shell {:dir "squint-demo"} "npm install")
(shell {:dir "squint-demo"} "npx jspm link index.html -o index.html --cache no-cache")
(fs/create-dirs "public/squint-cdn-demo")
(fs/copy "squint-demo/index.mjs" "public/squint-cdn-demo/index.mjs" {:replace-existing true})
(fs/copy "squint-demo/index.html" "public/squint-cdn-demo/index.html" {:replace-existing true}))}
-dev {:depends [vite:dev squint:watch-cljs watch-cljs]}
dev {:doc "Compiles all cljs to mjs, runs vite in dev and starts a cherry watcher to recompile changed cljs. When run as `bb dev collab` also starts a Y.js collaboration server."
;; :depends [compile]
:task (run '-dev {:parallel true})}}}