|
| 1 | +{:paths ["bb"] |
| 2 | + :deps {org.babashka/http-server {:mvn/version "0.1.11"} |
| 3 | + org.babashka/cli {:mvn/version "0.7.51"}} |
| 4 | + :pods {clj-kondo/clj-kondo {:version "2023.01.20"}} |
| 5 | + :tasks |
| 6 | + {:requires ([babashka.cli :as cli] |
| 7 | + [babashka.fs :as fs] |
| 8 | + [pod.borkdude.clj-kondo :as clj-kondo]) |
| 9 | + :init |
| 10 | + (do |
| 11 | + (def lint-paths |
| 12 | + ["bb.edn" "deps.edn" "bb" "src"])) |
| 13 | + |
| 14 | + hooks |
| 15 | + {:doc "Hook related commands" |
| 16 | + :requires ([git-hooks :as gh]) |
| 17 | + :task (apply gh/hooks *command-line-args*)} |
| 18 | + |
| 19 | + clean |
| 20 | + (shell "rm -rf .vpyenv .vnodeenv node_modules") |
| 21 | + |
| 22 | + lint |
| 23 | + {:doc "Lint all code directories with clj-kondo." |
| 24 | + :task (do (clj-kondo/print! |
| 25 | + (clj-kondo/run! {:lint lint-paths})) |
| 26 | + (clojure (str "-Tcljfmt check :paths '" (prn-str lint-paths) "'")))} |
| 27 | + |
| 28 | + format |
| 29 | + {:doc "Format all code with cljfmt." |
| 30 | + :task (do (clojure "-Ttools install-latest :lib io.github.weavejester/cljfmt :as cljfmt") |
| 31 | + (clojure (str "-Tcljfmt fix :paths '" (prn-str lint-paths) "'")))} |
| 32 | + |
| 33 | + upgrade |
| 34 | + {:doc "Upgrade all code with antq." |
| 35 | + :task (do (clojure "-Ttools install-latest :lib com.github.liquidz/antq :as antq") |
| 36 | + (clojure "-Tantq outdated :check-clojure-tools true :upgrade true"))} |
| 37 | + |
| 38 | + watson |
| 39 | + {:doc "Scan for vulnerable direct/transitive dependencies with clj-watson." |
| 40 | + :task (do (clojure "-Ttools install-latest :lib io.github.clj-holmes/clj-watson :as clj-watson") |
| 41 | + (clojure "-Tclj-watson scan '{:output \"stdout\" :dependency-check-properties nil :fail-on-result true :deps-edn-path \"deps.edn\" :suggest-fix true :aliases [\"*\"] :database-strategy \"dependency-check\"}'"))} |
| 42 | + |
| 43 | + -vpyenv-install |
| 44 | + (if-not (fs/exists? ".vpyenv") |
| 45 | + (do |
| 46 | + (shell "python3 -m venv .vpyenv") |
| 47 | + (shell "bash -c" "source .vpyenv/bin/activate && pip install -q --upgrade pip"))) |
| 48 | + |
| 49 | + -vnodeenv-install |
| 50 | + {:depends [-vpyenv-install] |
| 51 | + :task (if-not (fs/exists? ".vpyenv/bin/nodeenv") |
| 52 | + (shell "bash -c" "source .vpyenv/bin/activate && pip install -q nodeenv"))} |
| 53 | + |
| 54 | + -node-install |
| 55 | + {:depends [-vnodeenv-install] |
| 56 | + :task (if-not (fs/exists? ".vnodeenv") |
| 57 | + (shell "bash -c" "source .vpyenv/bin/activate && nodeenv -q .vnodeenv"))} |
| 58 | + |
| 59 | + -npm-install |
| 60 | + {:depends [-node-install] |
| 61 | + :task (shell "bash -c" "source .vnodeenv/bin/activate && npm install -q")} |
| 62 | + |
| 63 | + build |
| 64 | + {:depends [-npm-install] |
| 65 | + :doc "Runs build for clojurescript + tailwind." |
| 66 | + :task (do |
| 67 | + (shell "bash -c 'source .vnodeenv/bin/activate && npx browserslist@latest --update-db'") |
| 68 | + (shell "bash -c 'source .vnodeenv/bin/activate && npm run build'"))} |
| 69 | + |
| 70 | + watch |
| 71 | + {:depends [build] |
| 72 | + :doc "Runs start for `shadow-cljs` with `watch` option." |
| 73 | + :task (shell "bash -c 'source .vnodeenv/bin/activate && npm start'")} |
| 74 | + |
| 75 | + styles-watch |
| 76 | + {:depends [build] |
| 77 | + :doc "Runs styles-watch for tailwind with autorebuild." |
| 78 | + :task (shell "bash -c 'source .vnodeenv/bin/activate && npm run styles-watch'")}}} |
0 commit comments