This commit is contained in:
Michiel Borkent 2021-05-23 16:31:05 +02:00
parent 2548e78966
commit d8fef42c64
8 changed files with 238 additions and 39 deletions

View file

@ -1,18 +1,23 @@
#!/usr/bin/env bb
(require '[babashka.fs :as fs]
'[babashka.tasks :refer [shell]]
'[clojure.string :as str])
'[babashka.tasks :refer [shell]])
(fs/copy "resources/public/index.html" "gh-pages"
{:replace-existing true})
(shell "clojure -M:dev -m shadow.cljs.devtools.cli release main")
(def index-file (fs/file "gh-pages" "index.html"))
(spit index-file (str/replace (slurp index-file) "main.js" "sci_script_tag.js"))
(fs/create-dirs (fs/file "gh-pages" "js"))
(fs/copy (fs/file "resources" "public" "js" "main.js")
(fs/file "gh-pages" "js" "sci_script_tag.js")
{: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)
(run! (fn [f]
(println "Copying" (str f))
(fs/copy f
js-target-dir
{:replace-existing true}))
(fs/glob js-source-dir "sci-script-tag*.js"))
(def with-gh-pages (partial shell {:dir "gh-pages"}))
(with-gh-pages "git add .")