Skip to content

Commit

Permalink
refactor(dev): use global dev-http in shadow-cljs
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf authored and tiensonqin committed Dec 22, 2021
1 parent f80af25 commit 7bd30a6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
1 change: 0 additions & 1 deletion .projectile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
-/.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
Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:paths ["src/main" "src/workspaces" "templates"]
{:paths ["src/main" "src/electron" "src/workspaces" "templates"]
:deps
{org.clojure/clojure {:mvn/version "1.10.0"}
cheshire/cheshire {:mvn/version "5.10.0"}
Expand Down
3 changes: 1 addition & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@
<script defer src="/static/js/highlight.min.js"></script>
<script defer src="/static/js/interact.min.js"></script>
<script defer src="/static/js/lsplugin.core.js"></script>
<script defer src="/static/js/common.js"></script>
<script defer src="/static/js/main.js"></script>
<script defer src="/static/js/code-editor.js"></script>
<script defer src="/static/js/age-encryption.js"></script>
<script defer src="/static/js/excalidraw.js"></script>
<script defer src="/static/js/main.js"></script>
<script>
/*!
* swiped-events.js - v1.1.6
Expand Down
3 changes: 1 addition & 2 deletions resources/electron.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/common.js"></script>
<script defer src="./js/main.js"></script>
<script defer src="./js/code-editor.js"></script>
<script defer src="./js/age-encryption.js"></script>
<script defer src="./js/excalidraw.js"></script>
<script defer src="./js/main.js"></script>
</body>
</html>
3 changes: 1 addition & 2 deletions resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@
<script defer src="./js/highlight.min.js"></script>
<script defer src="./js/interact.min.js"></script>
<script defer src="./js/lsplugin.core.js"></script>
<script defer src="./js/common.js"></script>
<script defer src="./js/main.js"></script>
<script defer src="./js/code-editor.js"></script>
<script defer src="./js/age-encryption.js"></script>
<script defer src="./js/excalidraw.js"></script>
<script defer src="./js/main.js"></script>
</body>
</html>
51 changes: 24 additions & 27 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
{:deps true
:nrepl {:port 8701}

;; "." for /static
:dev-http {3001 ["public" "."]
3002 ["public/workspaces" "."]}

:builds
{:app {:target :browser
:module-loader true
:js-options {:ignore-asset-requires true} ;; handle `require(xxx.css)`
:modules {:common {:entries []}

:main
{:init-fn frontend.core/init
:depends-on #{:code-editor :age-encryption :excalidraw}}
:modules {:main
{:init-fn frontend.core/init}
;; :graph
;; {:entries [frontend.extensions.graph.force]
;; :depends-on #{:common}}
;; :depends-on #{:main}}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:common}}
:depends-on #{:main}}
:age-encryption
{:entries [frontend.extensions.age-encryption]
:depends-on #{:common}}
:depends-on #{:main}}
:excalidraw
{:entries [frontend.extensions.excalidraw]
:depends-on #{:common}}}
:depends-on #{:main}}}
:output-dir "./static/js"
:asset-path "/static/js"
:release {:asset-path "https://asset.logseq.com/static/js"}
Expand All @@ -35,11 +36,11 @@
:closure-defines {goog.debug.LOGGING_ENABLED true
frontend.config/GITHUB_APP_NAME #shadow/env "GITHUB_APP2_NAME"}

:dev {:asset-path "js"}
: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"
:watch-path "/static"
:watch-dir "static"
:preloads [devtools.preload
shadow.remote.runtime.cljs.browser]}}

Expand All @@ -63,7 +64,7 @@
:compiler-options {:source-map false}
:modules {:parser-worker {:entries [frontend.worker.parser]
:web-worker true
:prepend #shadow/env ["PATCH_PARSER_WORKER" :default ";;"]}}
:prepend #shadow/env ["PATCH_PARSER_WORKER" :default ";;"]}}
:release {:compiler-options {:infer-externs :auto}}}

:test {:target :node-test
Expand All @@ -74,25 +75,22 @@
:publishing {:target :browser
:module-loader true
:js-options {:ignore-asset-requires true}
:modules {:common {:entries []}

:main
{:init-fn frontend.publishing/init
:depends-on #{:common}}
:modules {:main
{:init-fn frontend.publishing/init}
;; :graph
;; {:entries [frontend.extensions.graph.force]
;; :depends-on #{:common}}
;; :depends-on #{:main}}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:common}}
:depends-on #{:main}}
:age-encryption
{:entries [frontend.extensions.age-encryption]
:depends-on #{:common}}
:depends-on #{:main}}
:excalidraw
{:entries [frontend.extensions.excalidraw]
:depends-on #{:common}}}
:output-dir "./static/js/publishing"
:asset-path "static/js"
:depends-on #{:main}}}
: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
Expand All @@ -111,9 +109,8 @@
: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"
:watch-path "/static"
:watch-dir "static"
:preloads [devtools.preload
shadow.remote.runtime.cljs.browser]}
:modules {:main {:entries [workspaces.main]}}}}}

0 comments on commit 7bd30a6

Please sign in to comment.