فهرست منبع

fix: publishing build failing b/c there are no source maps

See
https://github.com/logseq/publish-spa/actions/runs/11614252492/job/32341972020.
Decided to build and include source maps on release as it won't affect
initial load and improves debuggability
Gabriel Horner 11 ماه پیش
والد
کامیت
92cc1ce38c
3فایلهای تغییر یافته به همراه7 افزوده شده و 6 حذف شده
  1. 1 0
      deps/publishing/src/logseq/publishing.cljs
  2. 5 6
      deps/publishing/src/logseq/publishing/export.cljs
  3. 1 0
      shadow-cljs.edn

+ 1 - 0
deps/publishing/src/logseq/publishing.cljs

@@ -16,6 +16,7 @@ can be passed:
 * :ui/radix-color - Accent color. See available values in Settings.
 * :html-options - A map of values that are inserted into index.html. Map keys
   can be icon, name, alias, title, description and url
+* :repo - Name of repo
 * :repo-config - A graph's configuration
 * :db-graph? - Boolean which indicates if graph is db based
 * :default-notification-fn - Configure how errors are reported when creating the export.

+ 5 - 6
deps/publishing/src/logseq/publishing/export.cljs

@@ -8,7 +8,10 @@
 
 (def ^:api js-files
   "js files from publishing release build"
-  ["shared.js" "shared.js.map" "main.js" "main.js.map" "code-editor.js" "excalidraw.js" "tldraw.js" "db-worker.js" "db-worker.js.map"])
+  (->> ["shared.js" "main.js" "code-editor.js" "excalidraw.js" "tldraw.js" "db-worker.js"]
+       ;; Add source maps for all js files as it doesn't affect initial load time
+       (mapcat #(vector % (str % ".map")))
+       vec))
 
 (def ^:api static-dirs
   "dirs under static dir to copy over"
@@ -42,11 +45,7 @@
                 (fs/symlinkSync (node-path/join source-static-dir "js" "publishing" "cljs-runtime")
                                 (node-path/join output-static-dir "js" "cljs-runtime")))
             ;; remove publishing-dir
-            _ (when-not dev? (fse/remove publishing-dir))
-            ;; remove source map files
-            _ (p/all (map (fn [file]
-                            (fs/rmSync (node-path/join output-static-dir "js" (str file ".map")) #js {:force true}))
-                          ["main.js" "code-editor.js" "excalidraw.js"]))])))
+            _ (when-not dev? (fse/remove publishing-dir))])))
 
 (defn- copy-static-files-and-assets
   [static-dir repo-path output-dir {:keys [log-error-fn asset-filenames]

+ 1 - 0
shadow-cljs.edn

@@ -137,6 +137,7 @@
                                   goog.debug.LOGGING_ENABLED true}
                :compiler-options {:infer-externs      :auto
                                   :output-feature-set :es-next
+                                  :source-map true
                                   :externs            ["datascript/externs.js"
                                                        "externs.js"]
                                   :warnings           {:fn-deprecated false