Просмотр исходного кода

enhance(dev): Add more publish docs

enable linter now that namespaces are documented
Gabriel Horner 1 неделя назад
Родитель
Сommit
5d4a91eb7e

+ 2 - 3
.github/workflows/deps-publish.yml

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

+ 8 - 4
deps/publish/README.md

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

+ 1 - 0
deps/publish/src/logseq/publish/assets.cljs

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

+ 1 - 1
deps/publish/src/logseq/publish/async.clj

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

+ 1 - 0
deps/publish/src/logseq/publish/common.cljs

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

+ 1 - 0
deps/publish/src/logseq/publish/index.cljs

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

+ 1 - 0
deps/publish/src/logseq/publish/meta_store.cljs

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

+ 2 - 1
deps/publish/src/logseq/publish/model.cljs

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

+ 1 - 0
deps/publish/src/logseq/publish/render.cljs

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

+ 1 - 0
deps/publish/src/logseq/publish/routes.cljs

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

+ 1 - 0
deps/publish/src/logseq/publish/worker.cljs

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

+ 6 - 0
deps/publish/worker/README.md

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