From f80af25b94d1cbff2457a86813443877d0745328 Mon Sep 17 00:00:00 2001 From: Andelf Date: Fri, 17 Dec 2021 16:35:06 +0800 Subject: [PATCH] enhance: format build cfgs, reorder module deps --- .projectile | 1 + deps.edn | 96 +++++++++--------- public/index.html | 3 +- resources/electron.html | 3 +- resources/index.html | 3 +- shadow-cljs.edn | 220 +++++++++++++++++++--------------------- 6 files changed, 157 insertions(+), 169 deletions(-) diff --git a/.projectile b/.projectile index d55ff06403c..f3471f58b0a 100644 --- a/.projectile +++ b/.projectile @@ -5,6 +5,7 @@ -/.cpcache -/.shadow-cljs/ -/resources/static/js/cljs-runtime/ +-/resources/static/js/common.js -/resources/static/js/main.js -/resources/static/js/sentry.min.js -/resources/static/js/highlight.min.js diff --git a/deps.edn b/deps.edn index 75b633eb652..6d8002d4c18 100755 --- a/deps.edn +++ b/deps.edn @@ -1,58 +1,54 @@ {:paths ["src/main" "src/workspaces" "templates"] :deps - {org.clojure/clojure {:mvn/version "1.10.0"} - cheshire/cheshire {:mvn/version "5.10.0"} - rum/rum {:mvn/version "0.12.3"} + {org.clojure/clojure {:mvn/version "1.10.0"} + cheshire/cheshire {:mvn/version "5.10.0"} + rum/rum {:mvn/version "0.12.3"} ;; rum {:local/root "/home/tienson/codes/source/clj/rum"} ;; persistent-sorted-set {:mvn/version "0.1.2"} - datascript/datascript {:git/url "https://github.com/logseq/datascript", - :sha "de8df66e69ecd847c048f548fa0d5de0d4378bd0"} - datascript-transit/datascript-transit - {:mvn/version "0.3.0" - :exclusions [datascript/datascript]} - borkdude/rewrite-edn {:git/url "https://github.com/borkdude/rewrite-edn" - :sha "edd87dc7f045f28d7afcbfc44bc0f0a2683dde62"} - funcool/promesa {:mvn/version "4.0.2"} - medley/medley {:mvn/version "1.2.0"} - metosin/reitit-frontend {:mvn/version "0.3.10"} - cljs-bean/cljs-bean {:mvn/version "1.5.0"} - prismatic/dommy {:mvn/version "1.1.0"} - org.clojure/core.match {:mvn/version "1.0.0"} - ;; fork - com.andrewmcveigh/cljs-time {:git/url "https://github.com/logseq/cljs-time", - :sha "5704fbf48d3478eedcf24d458c8964b3c2fd59a9"} - cljs-drag-n-drop/cljs-drag-n-drop - {:mvn/version "0.1.0"} - cljs-http/cljs-http {:mvn/version "0.1.46"} - borkdude/sci {:mvn/version "0.1.1-alpha.6"} - hickory/hickory {:git/url "https://github.com/logseq/hickory", - :sha "9c2c2f1fc2c45efaad906e0faabc3201278deeaa"} - hiccups/hiccups {:mvn/version "0.3.0"} - tongue/tongue {:mvn/version "0.2.9"} - org.clojure/core.async {:mvn/version "1.3.610"} - thheller/shadow-cljs {:mvn/version "2.15.3"} - expound/expound {:mvn/version "0.8.6"} - com.lambdaisland/glogi {:mvn/version "1.0.116"} - binaryage/devtools {:mvn/version "1.0.2"} - camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"} - instaparse/instaparse {:mvn/version "1.4.10"} - nubank/workspaces {:mvn/version "1.1.1"} - frankiesardo/linked {:mvn/version "1.3.0"} - org.clojars.mmb90/cljs-cache {:mvn/version "0.1.4"}} + datascript/datascript {:git/url "https://github.com/logseq/datascript" + :sha "de8df66e69ecd847c048f548fa0d5de0d4378bd0"} + datascript-transit/datascript-transit {:mvn/version "0.3.0" + :exclusions [datascript/datascript]} + borkdude/rewrite-edn {:git/url "https://github.com/borkdude/rewrite-edn" + :sha "edd87dc7f045f28d7afcbfc44bc0f0a2683dde62"} + funcool/promesa {:mvn/version "4.0.2"} + medley/medley {:mvn/version "1.2.0"} + metosin/reitit-frontend {:mvn/version "0.3.10"} + cljs-bean/cljs-bean {:mvn/version "1.5.0"} + prismatic/dommy {:mvn/version "1.1.0"} + org.clojure/core.match {:mvn/version "1.0.0"} + com.andrewmcveigh/cljs-time {:git/url "https://github.com/logseq/cljs-time" ;; fork + :sha "5704fbf48d3478eedcf24d458c8964b3c2fd59a9"} + cljs-drag-n-drop/cljs-drag-n-drop {:mvn/version "0.1.0"} + cljs-http/cljs-http {:mvn/version "0.1.46"} + borkdude/sci {:mvn/version "0.1.1-alpha.6"} + hickory/hickory {:git/url "https://github.com/logseq/hickory" + :sha "9c2c2f1fc2c45efaad906e0faabc3201278deeaa"} + hiccups/hiccups {:mvn/version "0.3.0"} + tongue/tongue {:mvn/version "0.2.9"} + org.clojure/core.async {:mvn/version "1.3.610"} + thheller/shadow-cljs {:mvn/version "2.15.3"} + expound/expound {:mvn/version "0.8.6"} + com.lambdaisland/glogi {:mvn/version "1.0.116"} + binaryage/devtools {:mvn/version "1.0.2"} + camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"} + instaparse/instaparse {:mvn/version "1.4.10"} + nubank/workspaces {:mvn/version "1.1.1"} + frankiesardo/linked {:mvn/version "1.3.0"} + org.clojars.mmb90/cljs-cache {:mvn/version "0.1.4"}} :aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"] - :extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"} - org.clojure/tools.namespace {:mvn/version "0.2.11"} - cider/cider-nrepl {:mvn/version "0.26.0"} + :extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"} + org.clojure/tools.namespace {:mvn/version "0.2.11"} + cider/cider-nrepl {:mvn/version "0.26.0"} org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}} - :main-opts ["-m" "shadow.cljs.devtools.cli"]} - :test - {:extra-paths ["src/test/"] - :extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"} - org.clojure/test.check {:mvn/version "RELEASE"} - org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}} - :main-opts ["-m" "shadow.cljs.devtools.cli"]} + :main-opts ["-m" "shadow.cljs.devtools.cli"]} - :clj-kondo - {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2021.10.19"}} - :main-opts ["-m" "clj-kondo.main"]}}} + :test {:extra-paths ["src/test/"] + :extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"} + org.clojure/test.check {:mvn/version "1.1.1"} + org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}} + :main-opts ["-m" "shadow.cljs.devtools.cli"]} + + :clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2021.10.19"}} + :main-opts ["-m" "clj-kondo.main"]}}} diff --git a/public/index.html b/public/index.html index f52f9a43490..788278c06d4 100644 --- a/public/index.html +++ b/public/index.html @@ -51,10 +51,11 @@ - + + - + + diff --git a/resources/index.html b/resources/index.html index e8baffc0662..35970892df9 100644 --- a/resources/index.html +++ b/resources/index.html @@ -54,9 +54,10 @@ - + + diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 4f951f9233e..19cff8acd2c 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -1,131 +1,119 @@ ;; shadow-cljs configuration -{:deps true - :nrepl {:port 8701} +{:deps true + :nrepl {:port 8701} :builds - {:app - {:target :browser - :module-loader true - ;; handle `require(xxx.css)` - :js-options {:ignore-asset-requires true} - :modules {:main {:init-fn frontend.core/init} - ;; :graph - ;; {:entries [frontend.extensions.graph.force] - ;; :depends-on #{:main}} - :code-editor - {:entries [frontend.extensions.code] - :depends-on #{:main}} - :age-encryption - {:entries [frontend.extensions.age-encryption] - :depends-on #{:main}} - :excalidraw - {:entries [frontend.extensions.excalidraw] - :depends-on #{:main}}} + {:app {:target :browser + :module-loader true + :js-options {:ignore-asset-requires true} ;; handle `require(xxx.css)` + :modules {:common {:entries []} - :output-dir "./static/js" - :asset-path "/static/js" - :release {:asset-path "https://asset.logseq.com/static/js"} - :compiler-options {:infer-externs :auto - :output-feature-set :es-next-in - :source-map true - :externs ["datascript/externs.js" - "externs.js"] - :warnings {:fn-deprecated false}} - :closure-defines {goog.debug.LOGGING_ENABLED true - frontend.config/GITHUB_APP_NAME #shadow/env "GITHUB_APP2_NAME"} + :main + {:init-fn frontend.core/init + :depends-on #{:code-editor :age-encryption :excalidraw}} + ;; :graph + ;; {:entries [frontend.extensions.graph.force] + ;; :depends-on #{:common}} + :code-editor + {:entries [frontend.extensions.code] + :depends-on #{:common}} + :age-encryption + {:entries [frontend.extensions.age-encryption] + :depends-on #{:common}} + :excalidraw + {:entries [frontend.extensions.excalidraw] + :depends-on #{:common}}} + :output-dir "./static/js" + :asset-path "/static/js" + :release {:asset-path "https://asset.logseq.com/static/js"} + :compiler-options {:infer-externs :auto + :output-feature-set :es-next-in + :source-map true + :externs ["datascript/externs.js" + "externs.js"] + :warnings {:fn-deprecated false}} + :closure-defines {goog.debug.LOGGING_ENABLED true + frontend.config/GITHUB_APP_NAME #shadow/env "GITHUB_APP2_NAME"} - :devtools - ;; before live-reloading any code call this function - {:before-load frontend.core/stop - ;; after live-reloading finishes call this function - :after-load frontend.core/start - :http-root "public" - :http-port 3001 - :watch-path "static" - :preloads [devtools.preload - shadow.remote.runtime.cljs.browser]}} + :devtools {:before-load frontend.core/stop ;; before live-reloading any code call this function + :after-load frontend.core/start ;; after live-reloading finishes call this function + :http-root "public" + :http-port 3001 + :watch-path "static" + :preloads [devtools.preload + shadow.remote.runtime.cljs.browser]}} - :electron {:target :node-script - :output-to "static/electron.js" - :main electron.core/main - :devtools - {:before-load electron.core/stop - :after-load electron.core/start} - :compiler-options - {:infer-externs :auto - :source-map true - :source-map-include-sources-content true - :source-map-detail-level :all - :externs ["datascript/externs.js" - "externs.js"] - :warnings {:fn-deprecated false}}} + :electron {:target :node-script + :output-to "static/electron.js" + :main electron.core/main + :devtools {:before-load electron.core/stop + :after-load electron.core/start} + :compiler-options {:infer-externs :auto + :source-map true + :source-map-include-sources-content true + :source-map-detail-level :all - :parser-worker - {:target :browser - :output-dir "./static/js" - :asset-path "./js" - :compiler-options {:source-map false - :source-map-include-sources-content false} - :modules {:parser-worker {:entries [frontend.worker.parser] - :web-worker true - :prepend #shadow/env ["PATCH_PARSER_WORKER" :default ";;"] - }} - :release {:compiler-options {:infer-externs :auto}}} + :externs ["datascript/externs.js" + "externs.js"] + :warnings {:fn-deprecated false}}} - :test - {:target :node-test - :output-to "static/tests.js" - :closure-defines {frontend.util/NODETEST true} - :devtools {:enabled false}} + :parser-worker {:target :browser + :output-dir "./static/js" + :asset-path "./js" + :compiler-options {:source-map false} + :modules {:parser-worker {:entries [frontend.worker.parser] + :web-worker true + :prepend #shadow/env ["PATCH_PARSER_WORKER" :default ";;"]}} + :release {:compiler-options {:infer-externs :auto}}} - :publishing - {:target :browser - :module-loader true - :js-options {:ignore-asset-requires true} - :modules {:main {:init-fn frontend.publishing/init} - ;; :graph - ;; {:entries [frontend.extensions.graph.force] - ;; :depends-on #{:main}} - :code-editor - {:entries [frontend.extensions.code] - :depends-on #{:main}} - :age-encryption - {:entries [frontend.extensions.age-encryption] - :depends-on #{:main}} - :excalidraw - {:entries [frontend.extensions.excalidraw] - :depends-on #{:main}}} + :test {:target :node-test + :output-to "static/tests.js" + :closure-defines {frontend.util/NODETEST true} + :devtools {:enabled false}} - :output-dir "./static/js/publishing" - :asset-path "static/js" + :publishing {:target :browser + :module-loader true + :js-options {:ignore-asset-requires true} + :modules {:common {:entries []} - :closure-defines {frontend.config/PUBLISHING true - goog.debug.LOGGING_ENABLED true} - - :compiler-options {:infer-externs :auto - :output-feature-set :es-next - :externs ["datascript/externs.js" - "externs.js"] - :warnings {:fn-deprecated false}} - :devtools - ;; before live-reloading any code call this function - {:before-load frontend.core/stop - ;; after live-reloading finishes call this function - :after-load frontend.core/start - :preloads [devtools.preload]}} + :main + {:init-fn frontend.publishing/init + :depends-on #{:common}} + ;; :graph + ;; {:entries [frontend.extensions.graph.force] + ;; :depends-on #{:common}} + :code-editor + {:entries [frontend.extensions.code] + :depends-on #{:common}} + :age-encryption + {:entries [frontend.extensions.age-encryption] + :depends-on #{:common}} + :excalidraw + {:entries [frontend.extensions.excalidraw] + :depends-on #{:common}}} + :output-dir "./static/js/publishing" + :asset-path "static/js" + :closure-defines {frontend.config/PUBLISHING true + goog.debug.LOGGING_ENABLED true} + :compiler-options {:infer-externs :auto + :output-feature-set :es-next + :externs ["datascript/externs.js" + "externs.js"] + :warnings {:fn-deprecated false}} + :devtools {:before-load frontend.core/stop + :after-load frontend.core/start + :preloads [devtools.preload]}} :cards {:target nubank.workspaces.shadow-cljs.target :ns-regexp "(test|cards)$" - :output-dir "./static/js/workspaces" + :output-dir "./public/workspaces/static/js/workspaces" :asset-path "/static/js/workspaces" - :preloads [] ; optional, list namespaces to be pre loaded - :devtools - { - :after-load nubank.workspaces.core/after-load - :loader-mode :eval - :http-root "public/workspaces" - :http-port 3002 - :watch-path "static" - :preloads [devtools.preload - shadow.remote.runtime.cljs.browser]} - :modules {:main {:entries [workspaces.main]}}}}} + :preloads [] ;; optional, list namespaces to be pre loaded + :devtools {:after-load nubank.workspaces.core/after-load + :loader-mode :eval + :http-root "public/workspaces" + :http-port 3002 + :watch-path "static" + :preloads [devtools.preload + shadow.remote.runtime.cljs.browser]} + :modules {:main {:entries [workspaces.main]}}}}}