forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also rename dep to publishing for consistency with existing names
- Loading branch information
1 parent
5186070
commit fef07fe
Showing
28 changed files
with
260 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: logseq/publishing CI | ||
|
||
on: | ||
# Path filters ensure jobs only kick off if a change is made to publishing or | ||
# its local dependencies | ||
push: | ||
branches: [master] | ||
paths: | ||
- 'deps/publishing/**' | ||
# db is a local dep that could break functionality in this lib and should trigger this | ||
- 'deps/db/**' | ||
- '.github/workflows/publishing.yml' | ||
- '!deps/publishing/**.md' | ||
pull_request: | ||
branches: [master] | ||
paths: | ||
- 'deps/publishing/**' | ||
- 'deps/db/**' | ||
- '.github/workflows/publishing.yml' | ||
- '!deps/publishing/**.md' | ||
|
||
defaults: | ||
run: | ||
working-directory: deps/publishing | ||
|
||
env: | ||
CLOJURE_VERSION: '1.10.1.763' | ||
# This is the same as 1.8. | ||
JAVA_VERSION: '11' | ||
# This is the latest node version we can run. | ||
NODE_VERSION: '18' | ||
BABASHKA_VERSION: '1.0.168' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: 'yarn' | ||
cache-dependency-path: deps/publishing/yarn.lock | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Set up Babashka | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
bb: ${{ env.BABASHKA_VERSION }} | ||
|
||
- name: Fetch yarn deps | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Run nbb-logseq tests | ||
run: yarn test | ||
|
||
# In this job because it depends on an npm package | ||
- name: Load namespaces into nbb-logseq | ||
run: bb test:load-all-namespaces-with-nbb . | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Set up Clojure | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: ${{ env.CLOJURE_VERSION }} | ||
bb: ${{ env.BABASHKA_VERSION }} | ||
|
||
- name: Run clj-kondo lint | ||
run: clojure -M:clj-kondo --lint src test | ||
|
||
- name: Carve lint for unused vars | ||
run: bb lint:carve | ||
|
||
- name: Lint for vars that are too large | ||
run: bb lint:large-vars | ||
|
||
- name: Lint for namespaces that aren't documented | ||
run: bb lint:ns-docstrings | ||
|
||
- name: Lint for public vars that are private based on usage | ||
run: bb lint:minimize-public-vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{:paths ["src"] | ||
:api-namespaces [;; for nbb-logseq CLIs | ||
logseq.publishing] | ||
:report {:format :ignore}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## Description | ||
|
||
This library handles exporting the `frontend.publishing` single page | ||
application. This library is compatible with ClojureScript and with | ||
node/[nbb-logseq](https://github.com/logseq/nbb-logseq) to respectively provide | ||
frontend and Electron/commandline functionality. | ||
|
||
## API | ||
|
||
This library is under the parent namespace `logseq.publishing`. This library | ||
provides two namespaces for node/CLI contexts, `logseq.publishing` and | ||
`logseq.publishing.export` and two namespaces for the frontend, | ||
`logseq.publishing.html` and `logseq.publishing.db`. | ||
|
||
## Usage | ||
|
||
See `logseq.tasks.dev.publishing` for a CLI example. See the frontend for cljs usage. | ||
|
||
## Dev | ||
|
||
This follows the practices that [the Logseq frontend | ||
follows](/docs/dev-practices.md). Most of the same linters are used, with | ||
configurations that are specific to this library. See [this library's CI | ||
file](/.github/workflows/publishing.yml) for linting examples. | ||
|
||
### Setup | ||
|
||
To run linters and tests, you'll want to install yarn dependencies once: | ||
``` | ||
yarn install | ||
``` | ||
|
||
This step is not needed if you're just running the frontend application. | ||
|
||
### Testing | ||
|
||
Testing is done with nbb-logseq and | ||
[nbb-test-runner](https://github.com/nextjournal/nbb-test-runner). Some basic | ||
usage: | ||
|
||
``` | ||
# Run all tests | ||
$ yarn test | ||
# List available options | ||
$ yarn test -H | ||
# Run tests with :focus metadata flag | ||
$ yarn test -i focus | ||
``` | ||
|
||
### Managing dependencies | ||
|
||
See [standard nbb/cljs library advice in graph-parser](/deps/graph-parser/README.md#managing-dependencies). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{:min-bb-version "1.0.168" | ||
:deps | ||
{logseq/bb-tasks | ||
#_{:local/root "../../../bb-tasks"} | ||
{:git/url "https://github.com/logseq/bb-tasks" | ||
:git/sha "0d49051909bfa0c6b414e86606d82b4ea54f382c"}} | ||
|
||
:pods | ||
{clj-kondo/clj-kondo {:version "2023.03.17"}} | ||
|
||
:tasks | ||
{test:load-all-namespaces-with-nbb | ||
logseq.bb-tasks.nbb.test/load-all-namespaces | ||
|
||
lint:large-vars | ||
logseq.bb-tasks.lint.large-vars/-main | ||
|
||
lint:carve | ||
logseq.bb-tasks.lint.carve/-main | ||
|
||
lint:ns-docstrings | ||
logseq.bb-tasks.lint.ns-docstrings/-main | ||
|
||
lint:minimize-public-vars | ||
logseq.bb-tasks.lint.minimize-public-vars/-main} | ||
|
||
:tasks/config | ||
{:large-vars | ||
;; For vars with long running html | ||
{:metadata-exceptions #{:large-vars/html}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{:paths ["src"] | ||
:deps | ||
{logseq/db {:local/root "../db"}} | ||
|
||
:aliases | ||
{:clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "2023.03.17"}} | ||
:main-opts ["-m" "clj-kondo.main"]}}} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
deps/publish-spa/src/logseq/publish_spa.cljs → deps/publishing/src/logseq/publishing.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ublish-spa/src/logseq/publish_spa/db.cljs → .../publishing/src/logseq/publishing/db.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...sh-spa/src/logseq/publish_spa/export.cljs → ...lishing/src/logseq/publishing/export.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...-spa/test/logseq/publish_spa/db_test.cljs → ...shing/test/logseq/publishing/db_test.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.../test/logseq/publish_spa/export_test.cljs → ...g/test/logseq/publishing/export_test.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/test/logseq/publish_spa/test/helper.clj → ...ng/test/logseq/publishing/test/helper.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.