diff --git a/bb.edn b/bb.edn index c3ca7388..bca492c2 100644 --- a/bb.edn +++ b/bb.edn @@ -1,4 +1,4 @@ -{:deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.1.0"}} +{:deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.2.0"}} :paths [] :tasks {-base-deps {:doc "Dependencies for a task using bb" diff --git a/build_config.edn b/build_config.edn deleted file mode 100644 index bec954c7..00000000 --- a/build_config.edn +++ /dev/null @@ -1,21 +0,0 @@ -{:app-name "automaton-web" - :task-shared {:gha {} - :publication {:as-lib org.clojars.hephaistox/automaton-web - :deploy-to :clojars - :env {:la {} - :production {}} - :frontend {:css {} - :run-aliases - [:automaton-web-portfolio :browser-test :ltest]} - :license {} - :repo "git@github.com:hephaistox/automaton-web.git"} - :repl-aliases [:common-test :env-development-repl :build]} - :tasks - {:clean - {:dirs [".cpcache/" ".clj-kondo/.cache/" "tmp/" "target/" "node_modules/" ".shadow-cljs/builds/"]} - :lfe-css {} - :lfe-test {} - :lfe-watch {} - :reports {:forbiddenwords-words #{"automaton-build" "landing" "tap>"}} - :update-deps {:exclude-libs #{"com.taoensso/encore" "org.clojars.hephaistox/automaton-build@*-*" - "org.clojars.hephaistox/automaton-core@*-*"}}}} diff --git a/deps.edn b/deps.edn index 7607535f..642fb0d2 100644 --- a/deps.edn +++ b/deps.edn @@ -1,33 +1,27 @@ {:aliases - {:antq {:deps {com.github.liquidz/antq {:mvn/version "2.9.1217"}} + {:antq {:deps {com.github.liquidz/antq {:git/url "https://github.com/Kaspazza/antq" + :sha "a2606c7dc0edfae1990e367242b28accf2ded115"}} :main-opts ["-m" "antq.core"]} - :bb-deps {:extra-deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.1.0"}}} - :build {:extra-deps {org.clojars.hephaistox/automaton-build #:mvn{:version "3.1.0"}} - :ns-default build} - :cljs-deps {:extra-deps {binaryage/devtools #:mvn{:version "1.0.7"} - clj-commons/pushy #:mvn{:version "0.3.10"} + :cljs-deps {:extra-deps {clj-commons/pushy #:mvn{:version "0.3.10"} cljsjs/highlight #:mvn{:version "11.7.0-0"} com.andrewmcveigh/cljs-time #:mvn{:version "0.5.2"} com.taoensso/encore #:mvn{:version "3.62.1"} com.taoensso/sente #:mvn{:version "1.19.2"} com.taoensso/tempura #:mvn{:version "1.5.3"} - day8.re-frame/http-fx #:mvn{:version "0.2.4"} - day8.re-frame/re-frame-10x #:mvn{:version "1.9.9"} - day8.re-frame/tracing #:mvn{:version "0.6.2"} lambdaisland/uri #:mvn{:version "1.19.155"} metosin/reitit #:mvn{:version "0.7.1"} metosin/reitit-frontend #:mvn{:version "0.7.1"} - no.cjohansen/portfolio #:mvn{:version "2024.06.30"} re-frame/re-frame #:mvn{:version "1.4.3"} reagent/reagent #:mvn{:version "1.2.0"} thheller/shadow-cljs #:mvn{:version "2.28.12"}} - :extra-paths ["src/cljs/" - "src/cljc/" - "resources/" - "test/cljs/" - "test/cljc/" - "env/development/src/cljc/" - "env/development/src/cljs/"]} + :extra-paths ["src/cljs/" "src/cljc/" "resources/"]} + :cljs-dev-deps + {:extra-deps {binaryage/devtools #:mvn{:version "1.0.7"} + day8.re-frame/http-fx #:mvn{:version "0.2.4"} + day8.re-frame/re-frame-10x #:mvn{:version "1.9.9"} + day8.re-frame/tracing #:mvn{:version "0.6.2"} + no.cjohansen/portfolio #:mvn{:version "2024.06.30"}} + :extra-paths ["test/cljs/" "test/cljc/" "env/development/src/cljc/" "env/development/src/cljs/"]} :common-test {:exec-fn cognitect.test-runner.api/test :extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner" @@ -36,7 +30,11 @@ org.clojure/tools.reader #:mvn{:version "1.5.0"}} :extra-paths ["test/clj/" "test/cljc/" "test/resources/"] :jvm-opts ["-Dheph-conf=env/test/config.edn,env/common_config.edn" "-Dhephaistox-in-test=true"]} - :env-development-repl {:extra-deps {org.clojars.hephaistox/automaton-core #:mvn{:version "1.4.0"} + :deploy {:exec-args {:installer :remote} + :exec-fn deps-deploy.deps-deploy/deploy + :extra-deps {slipset/deps-deploy {:exclusions [org.slf4j/slf4j-nop] + :mvn/version "0.2.2"}}} + :env-development-repl {:extra-deps {org.clojars.hephaistox/automaton-core #:mvn{:version "1.5.0"} org.clojure/core.async #:mvn{:version "1.6.681"}} :extra-paths ["env/development/resources/" "env/development/src/clj/" @@ -62,7 +60,7 @@ metosin/reitit #:mvn{:version "0.7.1"} metosin/ring-http-response #:mvn{:version "0.9.4"} mount/mount #:mvn{:version "0.1.19"} - org.clojars.hephaistox/automaton-core #:mvn{:version "1.4.0"} + org.clojars.hephaistox/automaton-core #:mvn{:version "1.5.0"} ring-cors/ring-cors #:mvn{:version "0.1.13"} ring/ring #:mvn{:version "1.12.2"} ring/ring-anti-forgery #:mvn{:version "1.3.1"} diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 6435b9c6..00000000 --- a/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - 4.0.0 - jar - org.clojars.hephaistox - automaton-web - 2.1.0 - automaton-web - - - org.clojure - clojure - 1.11.4 - - - metosin - ring-http-response - 0.9.4 - - - metosin - muuntaja - 0.6.10 - - - ring - ring-ssl - 0.4.0 - - - org.clojars.hephaistox - automaton-core - 1.4.0 - - - ring-cors - ring-cors - 0.1.13 - - - hiccup - hiccup - 2.0.0-RC3 - - - com.taoensso - sente - 1.19.2 - - - ring - ring-anti-forgery - 1.3.1 - - - mount - mount - 0.1.19 - - - amalloy - ring-gzip-middleware - 0.1.4 - - - metosin - reitit - 0.7.1 - - - ring - ring - 1.12.2 - - - http-kit - http-kit - 2.8.0 - - - - src/clj/ - - - - clojars - https://repo.clojars.org/ - - - - - CC BY-NC 4.0 - https://creativecommons.org/licenses/by-nc/4.0/deed.en - - - diff --git a/project.edn b/project.edn index 63375617..b8fcb1e9 100644 --- a/project.edn +++ b/project.edn @@ -8,4 +8,13 @@ {:name "marked"}]} :frontend {:css "resources/css/custom.css" :run-aliases [:automaton-web-portfolio :browser-test :ltest]} - :publication {:as-lib org.clojars.hephaistox/automaton-web}} + :publication + {:base-branch "main" + :clojars true + :compiled-css-path "resources/public/css/compiled/styles.css" + :css-files ["resources/css/custom.css" "resources/css/main.css"] + :excluded-aliases + [:antq :codox :env-development-repl :env-development-test :common-test :cljs-dev-deps :deploy] + :la-branch "la" + :pom-xml-license {:name "CC BY-NC 4.0" + :url "https://creativecommons.org/licenses/by-nc/4.0/deed.en"}}} diff --git a/shadow-cljs.edn b/shadow-cljs.edn index baaf9b34..1ed10c82 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -10,7 +10,7 @@ :ltest {:ns-regexp "-test$" :output-to "target/ltest.js" :target :karma}} - :deps {:aliases [:cljs-deps]} + :deps {:aliases [:cljs-deps :cljs-dev-deps]} :dev-http {8080 ["public" "classpath:public"] 8290 ["target/browser-test"]} :nrepl {:port 8776}} diff --git a/src/clj/automaton_web/pages/admin.clj b/src/clj/automaton_web/pages/admin.clj deleted file mode 100644 index b9622641..00000000 --- a/src/clj/automaton_web/pages/admin.clj +++ /dev/null @@ -1,247 +0,0 @@ -#_{:heph-ignore {:forbidden-words ["automaton-build"]}} -(ns automaton-web.pages.admin - "Admin page" - (:require - [automaton-core.adapters.edn-utils :as edn-utils] - [automaton-core.adapters.env-variables :as env-vars] - [automaton-core.adapters.version :as version] - [automaton-core.app.build-config :as build-config] - [automaton-core.http.request :as request] - [automaton-web.components.icons :as web-icons] - [automaton-web.components.table :as web-table] - [automaton-web.configuration :as web-conf] - [mount.tools.graph :as mount-graph])) - -(defn menu-items - "Create menu items" - [] - [{:message "Docker hub" - :category "Deploy" - :uri "https://hub.docker.com/repositories"} - {:message "Sas actions" - :category "Deploy" - :uri "https://github.com/hephaistox/monorepo/actions"} - {:message "Website" - :category "Development" - :uri "/"} - {:message "Shadow dashboard" - :category "Development" - :uri "http://localhost:9630/build/app"} - {:message "Cljs browser test" - :category "Development" - :uri (str "http://localhost:8081")} - {:message "Portfolio" - :category "Development" - :uri "http://localhost:8080/"} - {:message "404 page" - :category "Development" - :uri "this-page-doesnt-exists"} - {:message "Throw an exception" - :category "Development" - :uri "admin/throw-exception"} - {:message "Repos" - :category "Git" - :uri "https://github.com/orgs/hephaistox/repositories"} - {:message "Git automaton web" - :category "Git" - :uri "https://github.com/hephaistox/automaton-web"} - {:message "Git automaton core" - :category "Git" - :uri "https://github.com/hephaistox/automaton-core"} - {:message "Git automaton build" - :category "Git" - :uri "https://github.com/hephaistox/automaton-build"} - {:message "hephaistox" - :category "Git" - :uri "https://github.com/hephaistox/monorepo"} - {:message "Tailwind" - :category "Tooling documentation" - :uri "https://tailwindcss.com/docs/"} - {:message "Fontawesome Icons" - :category "Tooling documentation" - :uri "https://fontawesome.com/icons"} - {:message "Clojure docs" - :category "Tooling documentation" - :uri "https://clojuredocs.org/"} - {:message "Mermaid" - :category "Tooling documentation" - :uri "https://mermaid-js.github.io/mermaid/#/n00b-syntaxReference"} - {:message "Markdown" - :category "Tooling documentation" - :uri "https://www.markdownguide.org/cheat-sheet/"} - {:message "Babashka" - :category "Tooling documentation" - :uri "https://babashka.org/"} - {:message "Reframe" - :category "Tooling documentation" - :uri "https://day8.github.io/re-frame/"} - {:message "Reagent" - :category "Tooling documentation" - :uri "https://reagent-project.github.io/"} - {:message "Teams communication" - :category "Organization" - :uri "https://teams.microsoft.com/"} - {:message "Project tasks" - :category "Organization" - :uri - "https://dev.azure.com/mateusz0216/Hephaistox%20Agile/_boards/board/t/Hephaistox%20Agile%20Team/Stories"} - {:message "Shared files with team" - :category "Organization" - :uri - "https://hephaistox.sharepoint.com/sites/hephaistox/Shared%20Documents/Forms/AllItems.aspx"} - {:message "Shared files with customers" - :category "Organization" - :uri - "https://hephaistox.sharepoint.com/sites/customers-materials/Documents%20partages/Forms/AllItems.aspx?id=%2Fsites%2Fcustomers%2Dmaterials%2FDocuments%20partages%2FDownloadable%20materials&p=true&ga=1"}]) - -(defn sorted-items "Create categories of menu item" [m] (sort (group-by :category m))) - -(defn component-graph-deps - "Create component graph data from the mount components" - [graph] - (map (fn [m] - (-> m - (dissoc :order) - (assoc :status-color (if (contains? (:status m) :started) :green :red)))) - (sort-by :order graph))) - -(defn main-app-build-config-view - [build-config-edn] - (let [app-name (:app-name build-config-edn)] - [:div [:div (str app-name " full build config:")] (web-table/map->table build-config-edn)])) - -(defn display-links - [items-by-category] - [:div {:class ["flex flex-col"]} - [:h2 "Links"] - (for [[category items] items-by-category] - (when category - [:div - [:h3 {:class ["text-left"]} - category] - [:div {:class ["flex flex-wrap"]} - (for [{:keys [uri message]} items] - [:a {:class ["cursor-pointer select-none"] - :href uri - :target "blank"} - [:div {:class ["flex flex-row border-black border-solid border-2 m-2"]} - [:div {:class ["m-2 p-2"]} - message]]])]]))]) - -(defn all-apps-links - [cust-apps] - (let [admin-maps (reduce (fn [acc app] - (let [app-name (:app-name app) - app-repo-link "to be done" - git-repo {:message "Git repo" - :category app-name - :uri app-repo-link} - doc (when (:doc? app) - {:message "TBC Docs" - :category app-name - :uri ""}) - envs (reduce (fn [acc [_ v]] - (conj acc - (when (:web-link v) - {:message (str "web-" (:remote-name v)) - :category app-name - :uri (:web-link v)}) - (when (:log-link v) - {:message (str "log-" (:remote-name v)) - :category app-name - :uri (:log-link v)}))) - [] - (:run-env app))] - (vec (flatten (vec (apply merge (conj acc git-repo doc) envs)))))) - [] - cust-apps) - sorted-links (sorted-items admin-maps)] - (display-links sorted-links))) - -(defn- ignore-error [fn-try ret-val] (try (or (fn-try) ret-val) (catch Exception _ ret-val))) - -(defn envs-indication - [cust-apps] - (let [gh-token (env-vars/get-env "GH_TOKEN") - rows - (reduce - (fn [acc app] - (let [app-name (get-in app [:app-name]) - local-env (get (version/slurp-version (str app-name "/")) version/release) - gh-version (ignore-error #(request/http-get - (str "https://api.github.com/repos/hephaistox/" - app-name - "/contents/version.edn") - {:headers {"Authorization" (str "Bearer " gh-token) - "Accept" "application/vnd.github.raw+json"}}) - (atom "Error")) - gh-version-waited (ignore-error #(:release (read-string (:body @gh-version))) - "Error") - prod-env (ignore-error #(request/http-get - (str (get-in app - [:build-config :run-env :prod-env :web-link]) - "/api/version")) - (atom "Error")) - test-env (ignore-error #(request/http-get - (str (get-in app - [:build-config :run-env :test-env :web-link]) - "/api/version")) - (atom "Error"))] - (conj - acc - [app-name - local-env - gh-version-waited - (:body @prod-env) - (:body @test-env) - (if (= local-env gh-version prod-env test-env) - (web-icons/icon - {:path-kw :svg/check-circle - :scale 0.03 - :color "green" - :class ["w-[20px] - h-[20px]"] - :hover? false}) - (web-icons/icon - {:path-kw :svg/x-circle - :scale 0.03 - :color "red" - :class ["w-[20px] - h-[20px]"] - :hover? false}))]))) - [] - cust-apps)] - (web-table/table {:headers ["App name" "Local env" "Github" "Prod env" "Test env" "Status"] - :rows rows}))) - -(defn current-app-stats - [graph] - [:div {:class ["flex flex-wrap"]} - [:div - [:h2 "Component graph deps"] - [:div {:class ["flex flex-col border-black border-solid border-2 m-2"]} - (for [{:keys [_status status-color name]} graph] - [:div {:class ["p-2" - (case status-color - :green "bg-green-300" - "bg-red-300")]} - name])]]]) - -(defn admin-page - "Admin page content hiccup and information. - Used to display admin page view." - [] - (let [items-by-category (sorted-items (menu-items)) - graph (component-graph-deps (mount-graph/states-with-deps)) - app-name (web-conf/read-param [:app-name]) - build-configs-paths (build-config/search-for-build-configs "") - build-configs (map edn-utils/read-edn build-configs-paths) - current-app-config (first (filter (fn [app] (= (:app-name app) app-name)) build-configs)) - cust-apps (filter (fn [app] (:cust-app? app)) build-configs)] - [:div {:id "admin-index" - :class ["text-center w-full"]} - (envs-indication cust-apps) - (display-links items-by-category) - (all-apps-links cust-apps) - (current-app-stats graph) - (main-app-build-config-view current-app-config)])) diff --git a/src/clj/automaton_web/pages/admin/route.clj b/src/clj/automaton_web/pages/admin/route.clj deleted file mode 100644 index f90cb413..00000000 --- a/src/clj/automaton_web/pages/admin/route.clj +++ /dev/null @@ -1,18 +0,0 @@ -(ns automaton-web.pages.admin.route - (:require - [automaton-web.adapters.be.http-response :as http-response] - [automaton-web.configuration :as web-conf] - [automaton-web.hiccup :as web-hiccup] - [automaton-web.pages.admin :as web-admin-index] - [automaton-web.pages.index :as web-pages-index])) - -(defn route - [] - ["" - {:get (fn [request] - (let [admin-content (web-admin-index/admin-page)] - (http-response/ok {"content-type" "text/html;charset=utf8"} - (-> request - (merge {:header-elements [(web-hiccup/js-script-raw - (web-conf/config-web-reference))]}) - (web-pages-index/build admin-content)))))}]) diff --git a/test/clj/automaton_web/pages/admin_test.clj b/test/clj/automaton_web/pages/admin_test.clj deleted file mode 100644 index f46e7694..00000000 --- a/test/clj/automaton_web/pages/admin_test.clj +++ /dev/null @@ -1,52 +0,0 @@ -(ns automaton-web.pages.admin-test - (:require - [automaton-web.pages.admin :as sut] - [clojure.test :refer [deftest is testing]])) - -(def graph - "Graph for test purposes" - (list {:name "#'automaton-core.configuration/conf-state" - :order 1 - :status #{:started} - :deps #{}} - {:name "#'optor.user/web-server" - :order 2 - :status #{:started} - :deps #{}} - {:name "#'caumond-sasu.core/web-server" - :order 3 - :status #{:stopped} - :deps #{}} - {:name "#'caumond-sasu.user/web-server" - :order 4 - :status #{:stopped} - :deps #{}} - {:name "#'optor.core/web-server" - :order 5 - :status #{:stopped} - :deps #{}})) - -(deftest component-graph-deps - (testing "Component graph" - (is - (= [{:name "#'automaton-core.configuration/conf-state" - :status #{:started} - :status-color :green - :deps #{}} - {:name "#'optor.user/web-server" - :status #{:started} - :status-color :green - :deps #{}} - {:name "#'caumond-sasu.core/web-server" - :status #{:stopped} - :status-color :red - :deps #{}} - {:name "#'caumond-sasu.user/web-server" - :status #{:stopped} - :status-color :red - :deps #{}} - {:name "#'optor.core/web-server" - :status #{:stopped} - :status-color :red - :deps #{}}] - (sut/component-graph-deps graph))))) diff --git a/version.edn b/version.edn index 3f907357..d644a3ce 100644 --- a/version.edn +++ b/version.edn @@ -1,2 +1 @@ -;; Last generated version, note a failed push consume a number -{:version "2.1.0"} \ No newline at end of file +{:version "2.2.0"} \ No newline at end of file