mirror of
https://github.com/logseq/logseq.git
synced 2026-04-29 08:26:40 +00:00
chore: mv publishing.cljs to deps/publishing
allows for faster publishing dev as publishing-backend workflow works against latest deps/publishing instead of cached version in .nbb
This commit is contained in:
@@ -80,8 +80,8 @@
|
||||
(defn publishing-backend
|
||||
"Builds publishing backend and copies over supporting frontend assets"
|
||||
[& args]
|
||||
(apply shell {:dir "scripts"}
|
||||
"yarn -s nbb-logseq -cp src -m logseq.tasks.dev.publishing"
|
||||
(apply shell {:dir "deps/publishing" :extra-env {"ORIGINAL_PWD" (fs/cwd)}}
|
||||
"yarn -s nbb-logseq -cp src:../graph-parser/src script/publishing.cljs"
|
||||
(into ["static"] args)))
|
||||
|
||||
(defn watch-publishing-frontend
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
(ns logseq.tasks.dev.publishing
|
||||
"Basic script for publishing from CLI"
|
||||
(:require [logseq.graph-parser.cli :as gp-cli]
|
||||
[logseq.publishing :as publishing]
|
||||
[logseq.db.sqlite.cli :as sqlite-cli]
|
||||
["fs" :as fs]
|
||||
["path" :as node-path]
|
||||
[clojure.edn :as edn]
|
||||
[datascript.core :as d]
|
||||
[logseq.db.sqlite.util :as sqlite-util]))
|
||||
|
||||
(defn- get-db [graph-dir]
|
||||
(let [{:keys [conn]} (gp-cli/parse-graph graph-dir {:verbose false})] @conn))
|
||||
|
||||
(defn- publish-file-graph [static-dir graph-dir output-path options]
|
||||
(let [repo-config (-> (node-path/join graph-dir "logseq" "config.edn") fs/readFileSync str edn/read-string)]
|
||||
(publishing/export (get-db graph-dir)
|
||||
static-dir
|
||||
graph-dir
|
||||
output-path
|
||||
(merge options {:repo (node-path/basename graph-dir)
|
||||
:repo-config repo-config
|
||||
:ui/theme "dark"
|
||||
:ui/radix-color :purple}))))
|
||||
|
||||
(defn- publish-db-graph [static-dir graph-dir output-path opts]
|
||||
(let [db-name (node-path/basename graph-dir)
|
||||
conn (sqlite-cli/open-db! (node-path/dirname graph-dir) db-name)
|
||||
repo-config (-> (d/q '[:find ?content
|
||||
:where [?b :file/path "logseq/config.edn"] [?b :file/content ?content]]
|
||||
@conn)
|
||||
ffirst
|
||||
edn/read-string)]
|
||||
(publishing/export @conn
|
||||
static-dir
|
||||
graph-dir
|
||||
output-path
|
||||
(merge opts {:repo (str sqlite-util/db-version-prefix db-name)
|
||||
:repo-config repo-config
|
||||
:db-graph? true
|
||||
:ui/theme "dark"
|
||||
:ui/radix-color :cyan}))))
|
||||
|
||||
(defn -main
|
||||
[& args]
|
||||
(when (< (count args) 3)
|
||||
(println "Usage: $0 STATIC-DIR GRAPH-DIR OUT-DIR")
|
||||
(js/process.exit 1))
|
||||
(let [[static-dir graph-dir output-path]
|
||||
;; Offset relative paths since they are run in a different directory than user is in
|
||||
(map #(if (node-path/isAbsolute %) % (node-path/resolve ".." %)) args)
|
||||
options {:dev? (contains? (set args) "--dev")}]
|
||||
(if (sqlite-cli/db-graph-directory? graph-dir)
|
||||
(publish-db-graph static-dir graph-dir output-path options)
|
||||
(publish-file-graph static-dir graph-dir output-path options))))
|
||||
Reference in New Issue
Block a user