{:tasks {:requires ([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"))} dev {:doc "Development build. Starts webserver and watches for changes." :task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")} prod {:doc "Builds production artifacts." :task (clojure {:extra-env {"SCI_ELIDE_VARS" "true"}} "-M:dev -m shadow.cljs.devtools.cli release main")} 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 Github pages with new release build." :task (do (run 'dist) (run 'bump-version) (shell "npm publish"))} gh-pages {:doc "Updates Github pages with new release build." :task (shell "script/release.clj")} replace-version {:doc "Ported from bash one-liners. Expects two versions. TODO: port to Clojure." :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))}}}