logseq / publish-spa

A github action and CLI to publish logseq graphs as a SPA app
MIT License
244 stars 14 forks source link

Error running CLI to publish graph #24

Closed emacsbliss closed 9 months ago

emacsbliss commented 9 months ago

What Happened?

When I run logseq-publish-spa output at root of my Logseq graph directory, I got error:

Error: Logseq static directory '../logseq/static' does not exist. Please provide a valid directory

it does not matter whether I created output directory or not.. I assume output directory is also at the root of the graph directory.

Reproduce the Bug

  1. open shell
  2. go to root directory of a Logseq graph
  3. run logseq-publish-spa output

Expected Behavior

the graph should be published successfully.

Desktop or Mobile Platform Information

MacOS: 14.2 (23C64) Logseq App: Version 0.10.5 (79) latest version of logseq-publish-spa

emacsbliss commented 9 months ago

It's very confusing to me why the tool complains about that ../logseq/static directory.. I don't see that in my graph, nor in the test-graph in this graph

logseq-cldwalker commented 9 months ago

Hi. Did you follow the instructions at https://github.com/logseq/publish-spa?tab=readme-ov-file#cli? The CLI relies on the publishing frontend being built in a separate logseq directory that is git cloned separately. The cloned logseq directory should be under the same parent directory as the graph you are publishing e.g.:

- parent-directory/
   - your-graph/
   - logseq/
      - static/
emacsbliss commented 9 months ago

I checked out 0.10.6 and build the static folder.

then running the command again gave me this error:

Parsing 94 files...
Export public pages unexpectedly failed with: #error {:message "ENOENT: no such file or directory, rename '-s/static/js/publishing/main.js' -> '-s/static/js/main.js'", :data {:type :sci/error, :line 30, :column 15, :message "ENOENT: no such file or directory, rename '-s/static/js/publishing/main.js' -> '-s/static/js/main.js'", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:ns #object[oq logseq.publishing.export], :file "/Users/emacsbliss/repo/publish-spa/.nbb/.cache/5971908985a498cc9b88b1da0df7f8799334ae7f/nbb-deps/logseq/publishing/export.cljs", :sci.impl/f-meta {:ns #object[oq promesa.protocols], :name -bind, :arglists ([_ f] [_ f executor]), :doc "Apply function to a computation and flatten."}} {:ns #object[oq logseq.publishing.export], :file "/Users/emacsbliss/repo/publish-spa/.nbb/.cache/5971908985a498cc9b88b1da0df7f8799334ae7f/nbb-deps/logseq/publishing/export.cljs", :sci.impl/f-meta {:ns #object[oq promesa.protocols], :name -promise, :arglists ([_]), :doc "Create a promise instance from other types"}} {:line 30, :column 15, :ns #object[oq logseq.publishing.export], :file "/Users/emacsbliss/repo/publish-spa/.nbb/.cache/5971908985a498cc9b88b1da0df7f8799334ae7f/nbb-deps/logseq/publishing/export.cljs", :sci.impl/f-meta {:ns #object[oq promesa.core], :name all, :arglists ([promises]), :doc "Given an array of promises, return a promise\n  that is fulfilled  when all the items in the\n  array are fulfilled.\n\n  Example:\n\n  (-> (all [(promise :first-promise)\n            (promise :second-promise)]\n      (then (fn [[first-result second-result]]))\n       (println (str first-result \", \" second-result)\n\n  Will print out\n  :first-promise, :second-promise.\n\n  If at least one of the promises is rejected, the resulting promise will be\n  rejected."}})}], :file "/Users/emacsbliss/repo/publish-spa/.nbb/.cache/5971908985a498cc9b88b1da0df7f8799334ae7f/nbb-deps/logseq/publishing/export.cljs"}, :cause #object[Error Error: ENOENT: no such file or directory, rename '-s/static/js/publishing/main.js' -> '-s/static/js/main.js']}
logseq-cldwalker commented 9 months ago

Can you share what commands you have run including the last one that resulted in the error? It seems you're pointing the CLI at a directory that doesn't have the publishing app built. From the instructions I shared, yarn install --frozen-lockfile && yarn gulp:build && clojure -M:cljs release publishing is a necessary step

emacsbliss commented 9 months ago

here's what I did:

cd ~/org
git clone https://github.com/logseq/logseq && cd logseq
git checkout 0.10.6
yarn install --frozen-lockfile && yarn gulp:build && clojure -M:cljs release publishing

cd roam
logseq-publish-spa output

then I got the error mentioned earlier

logseq-cldwalker commented 9 months ago

Is roam in ~/org or ~/org/logseq? It needs to be in ~/org in order for the command to work out of the box. The error message '-s/static/js/publishing/main.js' indicates that it's trying to copy a file from a -s directory which doesn't make sense

emacsbliss commented 9 months ago

full path for roam is ~/org/roam, logseq is located in ~/org/logseq. I think the directory structure is correct, I suspect the latest release of logseq has changes causing some file missing, probably renamed..

I can't see this directory exists: ~/org/logseq/static/js/publishing

emacsbliss commented 9 months ago

looks like repo has some updates, so I upgrade to latest version of this repo and now it works.

Thanks for helping!

Sansui233 commented 3 months ago

Exactly the same path issue here and I resolved it by adding command parameters which github action does:

# `logseq-publish-spa out` raise error, but
logseq-publish-spa out --static-directory ..\logseq\static\ # success

And after that, I tried " logseq-publish-spa out" again and it works too...