enhance(dev): Add more publish docs

enable linter now that namespaces are documented
This commit is contained in:
Gabriel Horner
2026-01-22 11:21:12 -05:00
parent 6932114afc
commit 5d4a91eb7e
12 changed files with 26 additions and 9 deletions

View File

@@ -97,6 +97,5 @@ jobs:
- name: Lint for vars that are too large
run: bb lint:large-vars
# TODO: Add docstrings
# - name: Lint for namespaces that aren't documented
# run: bb lint:ns-docstrings
- name: Lint for namespaces that aren't documented
run: bb lint:ns-docstrings

View File

@@ -1,6 +1,6 @@
## Description
Shared library for page publishing (snapshot payloads, SSR helpers, shared schemas, and storage contracts).
Shared library for page publish features (snapshot payloads, SSR helpers, shared schemas, and storage contracts).
The Cloudflare Durable Object implementation is expected to use SQLite with the
Logseq datascript fork layered on top. Page publish payloads are expected to
@@ -15,7 +15,7 @@ Namespaces live under `logseq.publish`.
## Usage
This module is intended to be consumed by the Logseq app and the publishing worker.
This module is intended to be consumed by the Logseq app and the publish worker.
## Dev
@@ -29,10 +29,14 @@ linting examples.
For one-time setup, install the [CloudFlare cli wrangler](https://developers.cloudflare.com/workers/wrangler/) with `npm install -g wrangler@latest`.
To test the publish feature locally, follow these steps:
To test the publish features locally, follow these steps:
* Run `yarn watch` or `yarn release` to build the publish worker js asset.
* Run `wrangler dev` in worker/ to start a local cloudflare worker server.
* In `frontend.config`, enable the commented out `PUBLISH-API-BASE` which points to a localhost url.
* Login on the desktop app.
* Go to any page and select `Publish` from its page menu.
* Go to any page and select `Publish` from its page menu.
### Deploy
When changes are ready to be deployed, run `yarn deploy`.

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.assets
"Handles publishing assets"
(:require [clojure.string :as string]
[logseq.publish.common :as publish-common])
(:require-macros [logseq.publish.async :refer [js-await]]))

View File

@@ -1,4 +1,4 @@
(ns logseq.publish.async
(ns ^:no-doc logseq.publish.async
(:require [shadow.cljs.modern]))
(defmacro js-await

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.common
"Provides common util fns"
(:require [clojure.string :as string]
[cognitect.transit :as transit]
[datascript.transit :as dt]

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.index
"Builds indices from payloads for features like tagged nodes"
(:require [clojure.string :as string]
[logseq.publish.model :as publish-model]))

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.meta-store
"Handles storing Durable Object in SQLite"
(:require [clojure.string :as string]
[logseq.publish.common :as publish-common])
(:require-macros [logseq.publish.async :refer [js-await]]))

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.model)
(ns logseq.publish.model
"Handles entity/model operations like conversion from datoms")
(defn merge-attr
[entity attr value]

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.render
"Renders published content as HTML"
(:require-macros [hiccups.core])
(:require [clojure.string :as string]
[hiccups.runtime]

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.routes
"Handles routing and responses for worker"
(:require [cljs-bean.core :as bean]
[clojure.string :as string]
[logseq.publish.assets :as publish-assets]

View File

@@ -1,4 +1,5 @@
(ns logseq.publish.worker
"Main public ns for worker"
(:require ["cloudflare:workers" :refer [DurableObject]]
[logseq.publish.meta-store :as meta-store]
[logseq.publish.routes :as publish-routes]

View File

@@ -34,6 +34,12 @@ metadata in a Durable Object backed by SQLite.
- Deletes all pages for a graph
- `GET /pages`
- Lists metadata entries (from the index DO)
- `GET /tag/:tag-name`
- List all pages tagged with `:tag-name`
- `GET /ref/:page-name`
- List all pages that reference `:page-name`
- `GET /user/:user-name`
- List all pages for `:user-name`
### Notes