• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    Clojure
  • License
    MIT License
  • Created over 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

nbb with features enabled for logseq

Description

For Logseq users

nbb-logseq provides easy CLJS scripting on Node.js for Logseq. Since logseq is primarily written with ClojureScript, this scripting environment has capabilities that are not possible in any other environment. For example, see here for a script that queries any logseq graph.

For Clojure users

nbb-logseq is a custom version of nbb that bundles support for datascript, datascript-transit and a couple other cljs libraries that are useful to logseq. A good amount of the datascript API is available as seen by its tests. Since nbb only loads features/libraries when they are required, users can write datascript based CLIs without concern of loading the other libraries.

Usage

Install nbb-logseq from npm:

npm install @logseq/nbb-logseq -g

Omit -g for a local install.

All the usage examples from https://github.com/babashka/nbb#usage apply to nbb-logseq e.g.

$ nbb-logseq -e '(+ 1 2 3)'
6

Dependency Management

nbb-logseq can use libraries from both NPM and ClojureScript. For NPM libraries, use package.json like you would in a Node.js project. For ClojureScript libraries, create a nbb.edn file and install babashka. The two main keys a nbb.edn file supports are :deps and :paths. See babashka docs for more about the format of this file and those keys. See nbb's docs for more info about how nbb's dependencies generally work.

Logseq as a Dependency

Logseq's graph parser is a ClojureScript library with npm dependencies. To use it as a dependency requires a nbb.edn for the ClojureScript code and a package.json for the npm dependencies. For a quickstart with these files, copy them from the fly.io example. Note that Logseq code is fetched via git with nbb.edn so a specific commit and git repository can be specified.

Projects using nbb-logseq

CLIs

Starting with version 1.2.168, nbb-logseq supports publishing node CLIs with a nbb.edn. This means that it's possible to write a script that uses logseq's graph-parser and share it with others so they can install it on their $PATH.

Community CLIs with a nbb.edn:

To install or build a CLI locally, install babashka and clojure.

Install a CLI

From any script directory that has a nbb.edn, install CLIs on $PATH with yarn global add $PWD or npm i -g. If using yarn and ~/.yarn/bin is not on $PATH, add it to your shell's rc file e.g. export PATH="$HOME/.yarn/bin:$PATH".

Build a CLI

To convert a nbb-logseq cljs script into a CLI that others can install and use:

  • Create a wrapper .mjs file that invokes your nbb-logseq cljs script.
  • Add a bin entry to package.json that maps your CLI name to the cljs file.

For a tutorial on doing the above, read nbb's publish doc.

Versioning

nbb-logseq follows the same versioning as nbb. In other words, an 0.4.0 for nbb-logseq provides nbb 0.4.0 with the additional libraries.

Contributing

Example contributions are welcome. For feature contributions, please discuss them first as this is a low level library that will be relied on by multiple CLIs.

LICENSE

See LICENSE.md

Development

These sections for those developing this project.

QA local branch

To QA that your branch works as expected on a dependent repository e.g. logseq/graph-parser:

  • bb release in this repo to build a local release.
  • yarn add /path/to/nbb-logseq in a dependent's repo.
  • Run yarn nbb-logseq FILE.cljs to run a given file. The graph-parser can confirm all it's namespaces load nbb-logseq with bb test:load-all-namespaces-with-nbb.

Release process

Steps to publish a new npm package:

  1. Update CHANGELOG.md if anything specific to nbb-logseq has been updated.
  2. Update nbb with bb update-nbb on https://github.com/babashka/nbb-features and confirm CI passes.
  • This is done to confirm that datascript and datascript-transit tests pass.
  1. Update nbb with bb update-nbb on this repo and confirm CI passes.
  • This is done to run the test suite passes which includes cljs-time tests.
  1. Run bb publish X.Y.Z where X.Y.Z is the version to publish. Push to github to publish.

More Repositories

1

logseq

A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: http://trello.com/b/8txSM12G/roadmap
Clojure
32,717
star
2

awesome-logseq

Awesome Logseq resources created by the community <3
2,260
star
3

logseq-plugin-samples

Logseq plugin samples for beginner 🌱
CSS
308
star
4

marketplace

A centralized packages manager for Logseq marketplace plugins.
JavaScript
253
star
5

mldoc

Another Emacs Org-mode and Markdown parser.
OCaml
239
star
6

publish-spa

A github action and CLI to publish logseq graphs as a SPA app
Clojure
217
star
7

git-auto

A Simple Shell Script To Do Git Commit And Push Automatically
Shell
181
star
8

publish

JavaScript
130
star
9

docs

Logseq documentation
Clojure
127
star
10

graph-validator

Validate your logseq graphs
Clojure
48
star
11

awesome-logseq-cn

31
star
12

rdf-export

Export a logseq graph to RDF
Clojure
29
star
13

plugins

Documentation site of Logseq plugins
HTML
19
star
14

deprecated-github-backend

Clojure
18
star
15

bb-tasks

Reusable babashka tasks used by logseq team
Clojure
17
star
16

rsapi

Logseq's rsapi: Encryption, Sync.
Rust
16
star
17

sqlite-db

SQLite integration via WASM
C
12
star
18

sites

Logseq home page
CSS
11
star
19

logseq-cn

Logseq δΈ­ζ–‡θ΅„ζ–™εΊ“
8
star
20

handbooks

Handbooks resources for Logseq.
Clojure
5
star
21

capacitor-file-sync

Logseq Sync capacitor plugin for iOS and Android
Swift
5
star
22

datahike-rs

Experimental datahike native binding
JavaScript
5
star
23

logseq-extension-example

An example Logseq extension that showcases Logseq's API
JavaScript
3
star
24

Ranker

Ranker is the home for prioritizing and tracking issues and feature requests. We pull in tickets from GitHub and discussions from Discourse, and use algorithm to rank requests so the most important features get built first.
Python
3
star
25

AgeEncryption

Age Encryption
Rust
2
star
26

logseq.github.io

https://docs.logseq.com
HTML
2
star