-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbb.edn
More file actions
75 lines (68 loc) · 4.53 KB
/
bb.edn
File metadata and controls
75 lines (68 loc) · 4.53 KB
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
{:paths ["script"]
:min-bb-version "0.5.0"
:tasks
{:enter (println "Entering " (:name (current-task)))
:requires ([babashka.fs :as fs]
[clojure.java.shell :refer [sh]])
:init (do
(def -app-name (first *command-line-args*))
(def -dist-dir "dist")
(def -css-output (str -dist-dir "/" -app-name "/css/output.css"))
(defn replacer [{:keys [dist manifest-file index-file title app-name]}]
(let [output-name-js (:output-name (first (read-string (slurp (str dist "/" app-name "/" manifest-file)))))
output-name-css "output.css"
html (slurp (str "template/" app-name "/index.html"))]
(spit (str dist "/" app-name "/" index-file)
(-> (slurp (str "template/" app-name "/index.html"))
(.replace "{title}" (str title))
(.replace "{css-source}" output-name-css)
(.replace "{js-source}" output-name-js))))))
fb:emu {:doc "Starts the firebase-emulator for database and hosting"
:task (shell {:continue true} "firebase emulators:start --only database,firestore")}
-dev:browser (do
(shell "open http://localhost:8010")
(shell "open http://localhost:9630"))
;-devcards:css (shell "npx tailwindcss -i ./template/styles/style.css -o ./public/devcards/css/output.css --watch")
; -o ./public/eykt/css/output.css
-dev:css (shell "npx tailwindcss -o ./public/booking/css/output.css --watch")
devcard:css (shell "npx tailwindcss -o ./public/devcard/css/output.css --watch")
-dev:watch (clojure (str "-M:shadow-cljs server "))
-dev {:depends [-dev:watch]}
stats {:depends []
:task (do
(sh "bash" "-c" (str "ls -l ./dist/" -app-name "/js/*.js >> ./history.md"))
(shell {:continue true} "cat ./history.md"))}
template {:task (do
(replacer
{:app-name -app-name
:dist "dist"
:manifest-file "/js/manifest.edn"
:index-file "index.html"
:title "Eykt"}))}
dev {:doc "requires `booking` or `eykt`"
:task (run '-dev {:parallel true})}
css {:task (shell (str "npx tailwindcss -o " -css-output))}
clean {:task (fs/delete-tree -dist-dir)}
build {:task (shell (str "clj -M:shadow-cljs release " -app-name))}
fonts {:task (do
(fs/copy-tree "template/booking/css" (str -dist-dir "/" -app-name "/css") :replace-existing)
(fs/copy-tree "template/booking/fonts" (str -dist-dir "/" -app-name "/fonts") :replace-existing)
(fs/copy-tree "template/booking/img" (str -dist-dir "/" -app-name "/img") :replace-existing))}
ornament {:task (do
(fs/delete-if-exists (str -dist-dir "/" -app-name "/css/ornament.css"))
(fs/create-dir (str -dist-dir "/" -app-name "/css"))
(fs/copy
(str "public/" -app-name "/css/ornament.css")
(str -dist-dir "/" -app-name "/css/ornament.css")
:replace-existing))}
deploy-test2 {:depends [clean build template ornament css fonts stats]
:task (let [app-name (case -app-name "eykt" "eyktv-22" "booking" "booking-22")]
(shell (str "firebase hosting:channel:deploy samplepreview --only " app-name)))}
-deploy-sample {:task (let [app-name (case -app-name "eykt" "eyktv-22" "booking" "booking-22")]
(shell (str "firebase hosting:channel:deploy samplepreview --only " app-name)))}
deploy-test {:depends [clean build template ornament css fonts stats -deploy-sample]
:task (let [app-name (case -app-name "eykt" "eyktv-22" "booking" "booking-22")]
(shell (str "firebase hosting:channel:deploy samplepreview --only " app-name)))}
deploy {:depends [clean build template ornament css fonts stats]
:task (let [app-name (case -app-name "eykt" "eyktv-22" "booking" "booking-22")]
(shell (str "firebase deploy --only hosting:" app-name)))}}}