54 lines
1.5 KiB
Clojure
Executable file
54 lines
1.5 KiB
Clojure
Executable file
#!/usr/bin/env bb
|
|
|
|
(require '[babashka.fs :as fs]
|
|
'[babashka.tasks :refer [shell]])
|
|
|
|
(fs/copy "resources/public/index.html" "gh-pages"
|
|
{:replace-existing true})
|
|
|
|
(fs/copy "resources/public/base.html" "gh-pages"
|
|
{:replace-existing true})
|
|
|
|
(fs/copy "resources/public/tictactoe.html" "gh-pages"
|
|
{:replace-existing true})
|
|
|
|
(def style-source-dir (fs/file "resources" "public" "css"))
|
|
(def style-target-dir (fs/file "gh-pages" "css"))
|
|
(fs/create-dirs style-target-dir)
|
|
(fs/copy "resources/public/css/style.css" style-target-dir
|
|
{:replace-existing true})
|
|
|
|
(def js-source-dir (fs/file "resources" "public" "js"))
|
|
(def js-target-dir (fs/file "gh-pages" "js"))
|
|
(fs/create-dirs js-target-dir)
|
|
|
|
(println "Compiling CLJS")
|
|
(shell "clojure -M:dev -m shadow.cljs.devtools.cli release main")
|
|
|
|
(def index-file (fs/file "gh-pages" "index.html"))
|
|
|
|
(def cljs-source-dir (fs/file "resources" "public" "cljs"))
|
|
(def cljs-target-dir (fs/file "gh-pages" "cljs"))
|
|
(fs/create-dirs cljs-target-dir)
|
|
|
|
(run! (fn [f]
|
|
(println "Copying" (str f))
|
|
(fs/copy f
|
|
cljs-target-dir
|
|
{:replace-existing true}))
|
|
(fs/glob cljs-source-dir "*.cljs"))
|
|
|
|
(run! (fn [f]
|
|
(println "Copying" (str f))
|
|
(fs/copy f
|
|
js-target-dir
|
|
{:replace-existing true}))
|
|
(fs/glob js-source-dir "scittle*.js"))
|
|
|
|
(def with-gh-pages (partial shell {:dir "gh-pages"}))
|
|
(with-gh-pages "git add .")
|
|
(with-gh-pages "git commit -m 'update build'")
|
|
(with-gh-pages "git push origin gh-pages")
|
|
|
|
nil
|