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
This commit is contained in:
Gabriel Horner
2024-10-31 12:05:28 -04:00
parent 1084f98dfc
commit 92cc1ce38c
3 changed files with 7 additions and 6 deletions

View File

@@ -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.

View File

@@ -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]

View File

@@ -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