diff --git a/.github/workflows/commit_validation.yml b/.github/workflows/commit_validation.yml index 4b8830e..91090b0 100644 --- a/.github/workflows/commit_validation.yml +++ b/.github/workflows/commit_validation.yml @@ -1,3 +1,4 @@ +# V1 - For all projects name: Commit validation on: push: @@ -18,45 +19,44 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cache clojure dependencies - uses: actions/cache@v4 - with: - path: /home/runner/.m2/repository - key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} - restore-keys: cljdeps- - name: Install java uses: actions/setup-java@v4 with: - distribution: 'zulu' - java-version: '22' + distribution: 'temurin' + java-version: '21' + check-latest: true - name: Install clojure tools # See https://github.com/DeLaGuardo/setup-clojure/commits/main/ - uses: DeLaGuardo/setup-clojure@cc67f8308550d0f18b0ba445c2476f84626a5d6a #v13.0 + uses: DeLaGuardo/setup-clojure@ada62bb3282a01a296659d48378b812b8e097360 #v13.2 with: - cli: 1.12.0.1479 # Clojure CLI based on tools.deps - bb: 1.12.195 # Babashka - clj-kondo: 2024.11.14 # Clj-kondo - zprint: 1.2.9 # zprint + cli: 1.12.0.1530 + bb: 1.12.197 + clj-kondo: 2025.02.20 + zprint: 1.2.9 - name: Lint run: bb lint -v - name: Setup zprint run: echo "{:search-config? true}" >> ~/.zprintrc - name: Install fdfind run: sudo rm /var/lib/man-db/auto-update && sudo apt-get install -y fd-find && mkdir -p ~/.local/bin/ && PATH=$PATH:~/.local/bin/ && ln -s $(which fdfind) ~/.local/bin/fd + - name: Cache clojure dependencies + uses: actions/cache@v4 + with: + path: /home/runner/.m2/repository + key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn', '.github/workflows/commit_validation.yml') }} + restore-keys: cljdeps- - name: format again to check the code pushed was uptodate run: bb format -v - name: Write git diff - show what has been changed by zprint 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@bde80484b437cece974f79da735a5cd1dfdc9b0b #v1 + uses: CatChen/check-git-status-action@fb60fe626b56d5a4adcb227327ba4d24326a873a #v1.4.4 with: fail-if-not-clean: true request-changes-if-not-clean: false push-if-not-clean: false - - name: test code in clojure - run: bb clj-test test-clj -v - - name: test code in clojurescript - run: bb cljs-node-test all -v + - name: test + run: bb gha - name: print infos just for debugging, and the logs run: bb heph-info diff --git a/.gitignore b/.gitignore index 3e1d3a4..6bde38b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,28 @@ +# V2 With javascript +# ******************************************************************************** +# auto-core +# ******************************************************************************** +## auto-build **/**/.nrepl-port **/.DS_Store **/.clj-kondo/.cache **/.cpcache/ -# Private credentials +### Private credentials **/.clever.json **/tmp +**/target -#intellij +### Intellij .idea/ **.iml **/**.iml -node_modules -.shadow-cljs - docs/wiki/ docs/codox/ -target + +## auto-core +**/.shadow-cljs +**/node_modules +**/.clever.json +**/.clever +pom.properties diff --git a/.zprintrc b/.zprintrc index ebbd6af..54f0e93 100644 --- a/.zprintrc +++ b/.zprintrc @@ -1,4 +1,5 @@ -;;See [doc](https://github.com/kkinnear/zprint/blob/d0bb27e51ac97b1cdae5ea32b9b953f66cd650b2/doc/reference.md#introduction-to-configuration) for more details +;; V1 - For all projects +;; See [doc](https://github.com/kkinnear/zprint/blob/d0bb27e51ac97b1cdae5ea32b9b953f66cd650b2/doc/reference.md#introduction-to-configuration) for more details {:style [:community :how-to-ns :sort-require diff --git a/README.org b/README.org index 418892a..4b047d4 100644 --- a/README.org +++ b/README.org @@ -20,8 +20,8 @@ If every tool, when ordered, or even of its own accord, could do the work that b * Main features - This project should be agnostic of any environment, so it should run on the following examples of technology: CLI, backend of web app, frontend of web app, Android frontend, Android backend, ... -- Create cljc versions of features which are not naturally behaving the same between clj and cljs: uuids, -- Data strucutre helpers : regular expression, strings, keywords, maps, sequences, uuids +- Create cljc versions of features which are not naturally behaving the same between clj and cljs: uuids, utf8 text coloring, format, regexp ... +- Data structure helpers : regular expression, strings, keywords, maps, sequences, uuids - Logging in clj and cljs with a proxy from cljc - Configuration management - Translation diff --git a/bb.edn b/bb.edn index 9a06ec2..db36342 100644 --- a/bb.edn +++ b/bb.edn @@ -1,10 +1,7 @@ -{:deps {io.github.hephaistox/auto-build {:git/sha "dd5f949add930adba45fc440bf18412a4069683c"}} +{:deps {com.github.hephaistox/auto-build {:git/sha "6e9a158ebf50ed9d0291f05c767b056c24508ca5"}} :paths ["src"] :tasks - {:init (do (def ^:dynamic exit System/exit)) - :requires [;;NOTE Should be as small as possible to ensure `lconnect` - ;;can start whatever the state of the code is. - [auto-build.os.exit-codes]] + {:requires [[auto-build.os.exit-codes] [auto-build.os.exiting :refer [exit]]] bp {:doc "Before push" :task (binding [exit (fn [exit-code & _] (when-not (zero? exit-code) exit-code))] (-> (or (run 'format) @@ -18,7 +15,11 @@ clean {:doc "Clean temporary files" :requires [[auto-build.tasks.clean :as task-clean] [auto-build.echo :refer [level1-header]]] - :task (-> (task-clean/clean level1-header "." [".DS_Store"] [".cpcache"] (current-task)) + :task (-> (task-clean/clean level1-header + "." + [".DS_Store"] + [".cpcache" ".shadow-cljs" "node_modules" "tmp" "target"] + (current-task)) exit)} clj-test {:doc "Test with clj" @@ -49,18 +50,19 @@ :task (do (shell "clj -M:antq") (shell "npm upgrade"))} docs {:doc "Docs" :requires [[auto-build.tasks.docs :as build-docs] [auto-build.echo :refer [level1-header]]] - :task (-> (build-docs/docs level1-header "." (current-task) "gh-pages") + :task (-> (build-docs/docs level1-header "." (current-task) "gh-pages" "codox") exit)} format {:doc "Format" :requires [[auto-build.tasks.formatting :as task-format] [auto-build.echo :refer [level1-header]]] :task (-> (task-format/format level1-header "." (current-task)) exit)} + gha {:doc "For github action tests" + :task (do (shell "bb clj-test test-clj -v") (shell "bb cljs-node-test all -v"))} heph-info {:doc "Hephaistox project info" - :extra-paths ["env/dev/resources"] :requires [[auto-build.tasks.heph-info :as heph-info] [auto-build.echo :refer [level1-header]]] - :task (-> (heph-info/heph-info level1-header (current-task)) + :task (-> (heph-info/heph-info level1-header (current-task) ".") exit)} lint {:doc "Lint" :requires [[auto-build.tasks.lint :as task-lint] [auto-build.echo :refer [level1-header]]] @@ -69,11 +71,5 @@ repl {:doc "Clojure repl" :override-builtin true :requires [[auto-build.tasks.repl :as build-repl] [auto-build.echo :refer [level1-header]]] - :task (-> (build-repl/repl level1-header "." (current-task)) - exit)} - uberjar {:doc "Uberjar" - :override-builtin true - :requires [[auto-build.tasks.uberjar :as build-uberjar] - [auto-build.echo :refer [level1-header]]] - :task (-> (build-uberjar/uberjar level1-header "." "target/uberjar" "") - exit)}}} + :task (-> (build-repl/repl level1-header "." (current-task) [:cljs-deps :test-clj] 7002) + exit)}}} \ No newline at end of file diff --git a/build/compile.clj b/build/compile.clj deleted file mode 100644 index 3042de5..0000000 --- a/build/compile.clj +++ /dev/null @@ -1,22 +0,0 @@ -(ns compile - (:require - [clojure.tools.build.api :refer [compile-clj create-basis jar]])) - -(defn compile-jar - [{:keys [target-dir] - :as _pars}] - (let [class-dir (str target-dir "/classes") - jar-file (str target-dir "/production/auto_core.jar") - basis (create-basis)] - (try (let [compile (compile-clj {:basis basis - :bindings {#'clojure.core/*assert* false - #'clojure.core/*warn-on-reflection* true} - :out :capture - :err :capture - :class-dir class-dir})] - (jar {:class-dir class-dir - :jar-file jar-file}) - {:compile-jar compile}) - (catch Exception e - {:compile-jar {:exception e} - :status :compilation-failed})))) diff --git a/deps.edn b/deps.edn index 45d8da8..f1c56f6 100644 --- a/deps.edn +++ b/deps.edn @@ -1,49 +1,35 @@ -{:aliases - {:antq {:deps {com.github.liquidz/antq {:mvn/version "2.10.1241"}} - :main-opts ["-m" "antq.core"]} - :build {:deps {io.github.clojure/tools.build {:git/sha "52cf7d6" - :git/tag "v0.10.6"}} - :extra-paths ["build"]} - :clj-test-runner {:exec-fn cognitect.test-runner.api/test - :extra-deps {com.cognitect/test-runner - {:git/url "https://github.com/cognitect-labs/test-runner" - :sha "3f288f1f16d167723ad87cc35b1dfee3c1681e10"}}} - :cljs-deps {:extra-deps {metosin/malli #:mvn{:version "0.16.1"} - thheller/shadow-cljs {:mvn/version "2.28.19"}} - :extra-paths - ["src/cljc" "src/cljs" "env/dev/resources" "test/cljc" "test/cljs" "test/resources"]} - :codox {:exec-args - {:description - "`auto-core` is about all core technical functionalities we may need to start a project." - :doc-paths ["docs/codox"] - :metadata {:doc/format :markdown} - :name "auto-core" - :source-uri "https://github.com/hephaistox/auto-core/blob/{version}/{filepath}#L{line}"} - :exec-fn codox.main/generate-docs - :extra-deps {codox/codox {:mvn/version "0.10.8"}}} - :repl {:exec-args {:port 7001} - :exec-fn auto-build.repl.entry-point/start - :extra-deps {cider/cider-nrepl {:mvn/version "0.50.2"} - io.github.hephaistox/auto-build {:git/sha - "e907e29f65049a805c5a33e2f60bbe838c268a1a"} - refactor-nrepl/refactor-nrepl {:mvn/version "3.10.0"}} - :extra-paths - ["env/dev/resources" "test/clj" "test/cljc" "test/resources" "test/src" "test/resources"]} - :test-clj {:extra-paths ["test/clj" "test/cljc" "test/resources"] - :main-opts - ["-m" "cognitect.test-runner" "-r" ".*-test.*" "-d" "test/clj" "test/cljc"]}} - :deps {babashka/fs #:mvn{:version "0.5.22"} - babashka/process #:mvn{:version "0.5.22"} - com.taoensso/tempura #:mvn{:version "1.5.4"} +{:aliases {:antq {:deps {com.github.liquidz/antq {:mvn/version "2.11.1276"} + org.slf4j/slf4j-nop {:mvn/version "2.0.17"}} + :main-opts ["-m" "antq.core"]} + :clj-test-runner {:exec-fn cognitect.test-runner.api/test + :extra-deps {com.cognitect/test-runner + {:git/url "https://github.com/cognitect-labs/test-runner" + :sha "3f288f1f16d167723ad87cc35b1dfee3c1681e10"}}} + :cljs-deps {:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.21"}} + :extra-paths ["src/cljc" "test/cljc" "test/cljs" "test/resources"]} + :codox {:exec-args + {:description "`auto-core` is about core technical functionalities" + :doc-paths ["docs/codox"] + :metadata {:doc/format :markdown} + :name "auto-core" + :source-uri + "https://github.com/hephaistox/auto-core/blob/{version}/{filepath}#L{line}"} + :exec-fn codox.main/generate-docs + :extra-deps {codox/codox {:mvn/version "0.10.8"}}} + :test-clj {:extra-paths ["test/clj" "test/cljc" "test/resources"] + :main-opts + ["-m" "cognitect.test-runner" "-r" ".*-test.*" "-d" "test/clj" "test/cljc"]}} + :deps {babashka/fs {:mvn/version "0.5.24"} + babashka/process {:mvn/version "0.5.22"} + com.taoensso/tempura {:mvn/version "1.5.4"} com.yetanalytics/colossal-squuid {:mvn/version "0.1.5"} - danlentz/clj-uuid #:mvn{:version "0.2.0"} - http-kit/http-kit #:mvn{:version "2.8.0"} - lambdaisland/uri #:mvn{:version "1.19.155"} - metosin/malli #:mvn{:version "0.16.1"} - mount/mount #:mvn{:version "0.1.20"} - org.apache.logging.log4j/log4j-api #:mvn{:version "2.24.1"} - org.apache.logging.log4j/log4j-core #:mvn{:version "2.24.1"} - org.apache.logging.log4j/log4j-slf4j2-impl #:mvn{:version "2.24.1"} + danlentz/clj-uuid {:mvn/version "0.2.0"} + http-kit/http-kit {:mvn/version "2.8.0"} + lambdaisland/uri {:mvn/version "1.19.155"} + metosin/malli {:mvn/version "0.17.0"} + org.apache.logging.log4j/log4j-api {:mvn/version "2.24.3"} + org.apache.logging.log4j/log4j-core {:mvn/version "2.24.3"} + org.apache.logging.log4j/log4j-slf4j2-impl {:mvn/version "2.24.3"} org.clojure/tools.cli {:mvn/version "1.1.230"} - org.clojure/tools.logging #:mvn{:version "1.3.0"}} + org.clojure/tools.logging {:mvn/version "1.3.0"}} :paths ["src/cljc" "src/clj"]} diff --git a/docs/img/automaton_duck.png b/docs/img/automaton_duck.png new file mode 100644 index 0000000..03661bc Binary files /dev/null and b/docs/img/automaton_duck.png differ diff --git a/env/dev/resources/run_config.edn b/env/dev/resources/run_config.edn deleted file mode 100644 index 409d611..0000000 --- a/env/dev/resources/run_config.edn +++ /dev/null @@ -1 +0,0 @@ -{:app-name "auto-core"} diff --git a/package-lock.json b/package-lock.json index 6901151..55e2800 100644 --- a/package-lock.json +++ b/package-lock.json @@ -235,9 +235,9 @@ } }, "node_modules/call-bind-apply-helpers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", - "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -249,14 +249,14 @@ } }, "node_modules/call-bound": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", - "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "get-intrinsic": "^1.2.6" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -553,18 +553,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", - "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", + "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "get-proto": "^1.0.0", + "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", @@ -819,9 +819,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", - "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "dev": true, "license": "MIT", "engines": { @@ -1125,9 +1125,9 @@ } }, "node_modules/shadow-cljs": { - "version": "2.28.20", - "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.28.20.tgz", - "integrity": "sha512-Q9N+aw2suSUZ6vmWhZupl0rkyjoYrnpU1WbMrNrbuUiKE6XjvT1vcBkTUrqkMJEPraV7u+H9b5d/RcKnj8nbhg==", + "version": "2.28.21", + "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.28.21.tgz", + "integrity": "sha512-O5VUJkTh0bWqPBSKoWnQwEe/jfvbxHkzCA7SEx8f1Eavb7nDFcoNFDkgGjJtaAyaaSw/cmABrT2EeksnXw/25g==", "dev": true, "license": "ISC", "dependencies": { diff --git a/shadow-cljs.edn b/shadow-cljs.edn index d602572..804267f 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -7,5 +7,6 @@ :output-to "tmp/ltest.js" :target :node-test}} :deps {:aliases [:cljs-deps]} - :dev-http {8290 ["tmp/browser-test"]} - :nrepl {:port 7002}} + :dev-http {9602 ["tmp/browser-test"]} + :http {:port 9502} + :nrepl {:port 7102}} diff --git a/src/build/compile.clj b/src/build/compile.clj deleted file mode 100644 index c7b6921..0000000 --- a/src/build/compile.clj +++ /dev/null @@ -1,15 +0,0 @@ -(ns compile - (:require - [clojure.tools.build.api :refer [compile-clj create-basis jar]])) - -(defn compile-jar - [{:keys [] - :as _args}] - (let [class-dir "target/classes" - basis (create-basis)] - (compile-clj {:basis basis - :bindings {#'clojure.core/*assert* false - #'clojure.core/*warn-on-reflection* true} - :class-dir class-dir}) - (jar {:class-dir class-dir - :jar-file "target/production/auto_core.jar"})))