Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/commit_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
check-latest: true
- name: Install clojure tools
# See https://github.com/DeLaGuardo/setup-clojure/commits/main/
uses: DeLaGuardo/setup-clojure@ada62bb3282a01a296659d48378b812b8e097360 #v13.2
uses: DeLaGuardo/setup-clojure@3fe9b3ae632c6758d0b7757b0838606ef4287b08 #v13.2
with:
cli: 1.12.0.1530
bb: 1.12.197
clj-kondo: 2025.02.20
zprint: 1.2.9
cli: 1.12.1.1550
bb: 1.12.207
clj-kondo: 2025.07.28
zprint: 1.3.0
- name: Lint
run: bb lint -v
- name: Setup zprint
Expand All @@ -51,7 +51,7 @@ jobs:
run: git diff
- name: Pushed code should already be formatted
# See https://github.com/CatChen/check-git-status-action
uses: CatChen/check-git-status-action@fb60fe626b56d5a4adcb227327ba4d24326a873a #v1.4.4
uses: CatChen/check-git-status-action@7ff019ee29f2307dca95397ae225037aa88eb4c7 #v1.4.4
with:
fail-if-not-clean: true
request-changes-if-not-clean: false
Expand Down
6 changes: 3 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
:source-uri "https://github.com/hephaistox/auto-build/blob/{version}/{filepath}#L{line}"}
:exec-fn codox.main/generate-docs
:extra-deps {codox/codox {:mvn/version "0.10.8"}}}
:for-clj-repl {:doc "Dependencies necessary to use"
:extra-deps {babashka/fs {:mvn/version "0.5.24"}
babashka/process {:mvn/version "0.5.22"}}}
:for-clj-repl {:doc "Dependencies necessary to use bb in clojure"
:extra-deps {babashka/fs {:mvn/version "0.5.26"}
babashka/process {:mvn/version "0.6.23"}}}
:test-bb {:extra-paths ["test/src" "test/resources"]
:main-opts ["-m" "cognitect.test-runner" "-r" ".*-test.*" "-d" "test/src"]}
:test-unit {:extra-paths ["env/unit/test/" "env/unit/resources"]
Expand Down
128 changes: 64 additions & 64 deletions src/auto_build/tasks/frontend.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,70 +28,70 @@
[printers app-dir app-alias target-dir repo-url]
(let [shadow-cljs (build-shadow/read printers app-dir)
shadow-output-dir (get-in shadow-cljs [:edn :builds (keyword app-alias) :output-dir])]
(-> {:status :success}
(execute-if-success printers
app-dir
verbose
["rm" "-fr" target-dir]
"Delete previous build"
"Error when deleting previous build"
:build-installation)
(execute-if-success printers
app-dir
verbose
["rm" "-fr" shadow-output-dir]
"Delete previous js build"
"Error when deleting previous js build"
:cljs-release-clean)
(execute-if-success printers
app-dir
verbose
["npm" "install"]
"Install npm packages"
"Error during npm packages installation"
:npm-installation)
(execute-if-success printers
app-dir
verbose
["npx" "shadow-cljs" "release" app-alias]
"Create a cljs release"
"Error during creation of a cljs release"
:cljs-release)
(execute-if-success printers
app-dir
verbose
["clojure" "-T:uberjar" ":target-dir" target-dir]
"Build the uberjar"
"Error during uberjar creation"
:uberjar)
(execute-if-success printers
target-dir
verbose
["git" "init" "-b" "master"]
"Creates a repo"
"Error during repo creation"
:create-repo)
(execute-if-success printers
target-dir
verbose
["git" "remote" "add" "clever" repo-url]
"Add clever remotes"
"Error when adding clever remotes"
:add-remote)
(execute-if-success printers
target-dir
verbose
["git" "add" "."]
"Add jar to index"
"Error when adding jar to index"
:add-jar-to-index)
(execute-if-success printers
target-dir
verbose
["git" "commit" "-m" "\"auto\""]
"Commit"
"Error during commit creation"
:commit))))
(cond-> {:status :success}
true (execute-if-success printers
app-dir
verbose
["rm" "-fr" target-dir]
"Delete previous build"
"Error when deleting previous build"
:build-installation)
true (execute-if-success printers
app-dir
verbose
["rm" "-fr" shadow-output-dir]
"Delete previous js build"
"Error when deleting previous js build"
:cljs-release-clean)
true (execute-if-success printers
app-dir
verbose
["npm" "install"]
"Install npm packages"
"Error during npm packages installation"
:npm-installation)
app-alias (execute-if-success printers
app-dir
verbose
["npx" "shadow-cljs" "release" app-alias]
"Create a cljs release"
"Error during creation of a cljs release"
:cljs-release)
true (execute-if-success printers
app-dir
verbose
["clojure" "-T:uberjar" ":target-dir" target-dir]
"Build the uberjar"
"Error during uberjar creation"
:uberjar)
true (execute-if-success printers
target-dir
verbose
["git" "init" "-b" "master"]
"Creates a repo"
"Error during repo creation"
:create-repo)
true (execute-if-success printers
target-dir
verbose
["git" "remote" "add" "clever" repo-url]
"Add clever remotes"
"Error when adding clever remotes"
:add-remote)
true (execute-if-success printers
target-dir
verbose
["git" "add" "."]
"Add jar to index"
"Error when adding jar to index"
:add-jar-to-index)
true (execute-if-success printers
target-dir
verbose
["git" "commit" "-m" "\"auto\""]
"Commit"
"Error during commit creation"
:commit))))

;; ********************************************************************************
;; *** Task
Expand Down
41 changes: 41 additions & 0 deletions src/auto_build/tasks/repl_fe.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(ns auto-build.tasks.repl-fe
(:require
[auto-build.os.cli-opts :as build-cli-opts]
[babashka.process :as p]))

;; ********************************************************************************
;; *** Task setup
;; ********************************************************************************

(def cli-opts
(-> []
(concat build-cli-opts/help-options build-cli-opts/verbose-options)
build-cli-opts/parse-cli-args))

(def verbose (get-in cli-opts [:options :verbose]))

;; ********************************************************************************
;; *** Task code
;; ********************************************************************************

(defn repl-fe*
[app-dir repl-aliases]
(let [cmd (concat ["npx" "shadow-cljs" "watch"] repl-aliases)]
(println "Execute" cmd)
(-> (apply p/shell
{:continue true
:dir app-dir}
cmd)
:exit)))

(defn repl-fe
[{:keys [title]
:as _printers}
app-dir
current-task
repl-aliases]
(if-let [exit-code (build-cli-opts/enter cli-opts current-task)]
exit-code
(let [title-msg (str "Start clj repl - alias " repl-aliases)]
(title title-msg)
(repl-fe* app-dir repl-aliases))))
48 changes: 48 additions & 0 deletions src/auto_build/tasks/web/css.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
(ns auto-build.tasks.web.css
(:require
[auto-build.os.cli-opts :as build-cli-opts]
[auto-build.os.cmd :as build-cmd
:refer [printing]]))

;; ********************************************************************************
;; *** Task setup
;; ********************************************************************************

(def cli-opts
(-> (concat build-cli-opts/help-options build-cli-opts/verbose-options)
build-cli-opts/parse-cli-args))

(def verbose (get-in cli-opts [:options :verbose]))

;; ********************************************************************************
;; *** Task code
;; ********************************************************************************

(defn css-repl-watch*
"Generate cljs repl"
[{:keys [normalln errorln]} app-dir css-file target-dir]
(normalln "Build frontend in production mode")
(let [cmd ["npx" "@tailwindcss/cli" "-i" css-file "-o" target-dir "--watch"]]
(when verbose
(-> cmd
build-cmd/to-str
print))
(printing cmd app-dir normalln errorln 100)))

(defn css-repl-watch
"Build the css file in dev mode, and deploy remotely

`uberjar-aliases` is a string of keywords that should be assembled to build the jar (called with -T)
`app-name` if the name as found in `shadow-cljs.edn`"
[{:keys [title _errorln]
:as printers}
app-dir
current-task
css-file
target-dir]
(if-let [exit-code (build-cli-opts/enter cli-opts current-task)]
exit-code
(let [title-msg "Starts web dev repl"]
(title title-msg)
(-> (css-repl-watch* printers app-dir css-file target-dir)
(build-cmd/status-to-exit-code printers title-msg)))))
42 changes: 42 additions & 0 deletions src/auto_build/tasks/web/dev_repl.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(ns auto-build.tasks.web.dev-repl
(:require
[auto-build.os.cli-opts :as build-cli-opts]
[auto-build.os.cmd :as build-cmd
:refer [printing]]))

;; ********************************************************************************
;; *** Task setup
;; ********************************************************************************

(def cli-opts
(-> (concat build-cli-opts/help-options build-cli-opts/verbose-options)
build-cli-opts/parse-cli-args))

(def verbose (get-in cli-opts [:options :verbose]))

;; ********************************************************************************
;; *** Task code
;; ********************************************************************************

(defn cljs-repl-watch*
"Generate cljs repl"
[{:keys [uri-str normalln errorln]} app-dir app-name]
(normalln "Build " (uri-str app-name) " frontend in production mode")
(printing ["npx" "shadow-cljs" "watch" app-name] app-dir normalln errorln 100))

(defn cljs-repl-watch
"Build the project in production mode, and deploy remotely

`uberjar-aliases` is a string of keywords that should be assembled to build the jar (called with -T)
`app-name` if the name as found in `shadow-cljs.edn`"
[{:keys [title _errorln]
:as printers}
app-dir
current-task
app-name]
(if-let [exit-code (build-cli-opts/enter cli-opts current-task)]
exit-code
(let [title-msg "Starts web dev repl"]
(title title-msg)
(-> (cljs-repl-watch* printers app-dir app-name)
(build-cmd/status-to-exit-code printers title-msg)))))
Loading
Loading