{"id":1165697,"url":"https://github.com/logseq/nbb-logseq","last_synced_at":"2025-04-09T12:05:42.113Z","repository":{"id":40780181,"uuid":"485527788","full_name":"logseq/nbb-logseq","owner":"logseq","description":"nbb with features enabled for logseq","archived":false,"fork":false,"pushed_at":"2024-05-22T13:34:36.000Z","size":2559,"stargazers_count":135,"open_issues_count":2,"forks_count":3,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-05-23T01:26:42.165Z","etag":null,"topics":["clojurescript","logseq","nodejs"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logseq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-25T20:38:58.000Z","updated_at":"2024-05-28T02:37:27.949Z","dependencies_parsed_at":"2023-12-18T16:47:59.276Z","dependency_job_id":"fb8d2e63-e196-4380-b67b-328d71f89a7a","html_url":"https://github.com/logseq/nbb-logseq","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":0.04347826086956519,"last_synced_commit":"cdbe6650e9a10d12c722c24608d7eac7381d1db5"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logseq%2Fnbb-logseq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logseq%2Fnbb-logseq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logseq%2Fnbb-logseq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logseq%2Fnbb-logseq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logseq","download_url":"https://codeload.github.com/logseq/nbb-logseq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280190,"owners_count":20912966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojurescript","logseq","nodejs"],"created_at":"2024-01-14T14:26:26.276Z","updated_at":"2025-04-09T12:05:42.087Z","avatar_url":"https://github.com/logseq.png","language":"Clojure","funding_links":[],"categories":["nodejs"],"sub_categories":[],"readme":"## Description\n### For Logseq users\n\n`nbb-logseq` provides [easy CLJS scripting on\nNode.js](https://github.com/babashka/nbb) for Logseq. Since logseq is primarily\nwritten with [ClojureScript](https://clojurescript.org/), this scripting\nenvironment has capabilities that are not possible in any other environment. For\nexample, [see here](examples/#query.cljs) for a script that queries any logseq\ngraph.\n\n### For Clojure users\n\n`nbb-logseq` is a custom version of [nbb](https://github.com/babashka/nbb) that\nbundles support for datascript, datascript-transit and a couple other cljs\nlibraries that are useful to logseq. A good amount of the datascript API is\navailable as [seen by its\ntests](https://github.com/babashka/nbb-features/blob/main/test/features/datascript/test_runner.cljs).\nSince nbb only loads features/libraries when they are required, users can write\ndatascript based CLIs without concern of loading the other libraries.\n\n## Usage\n\nInstall `nbb-logseq` from npm:\n\n`npm install @logseq/nbb-logseq -g`\n\nOmit `-g` for a local install.\n\nAll the usage examples from https://github.com/babashka/nbb#usage apply to\n`nbb-logseq` e.g.\n\n```clojure\n$ nbb-logseq -e '(+ 1 2 3)'\n6\n```\n\n## Dependency Management\n\n`nbb-logseq` can use libraries from both NPM and ClojureScript. For NPM\nlibraries,  use `package.json` like you would in a Node.js project. For\nClojureScript libraries, create a `nbb.edn` file and [install\nbabashka](https://github.com/babashka/babashka#installation). The two main keys\na `nbb.edn` file supports are `:deps` and `:paths`. See [babashka\ndocs](https://book.babashka.org/#_paths_and_deps) for more about the format of\nthis file and those keys. See [nbb's\ndocs](https://github.com/babashka/nbb#dependencies) for more info about how\nnbb's dependencies generally work.\n\n### Logseq as a Dependency\n\nLogseq's graph parser is a ClojureScript library with npm dependencies. To use\nit as a dependency requires a `nbb.edn` for the ClojureScript code and a\n`package.json` for the npm dependencies. For a quickstart with these files, copy\nthem from the [fly.io example](examples/fly-io). Note that Logseq code is fetched\nvia git with `nbb.edn` so a specific commit and git repository can be\nspecified.\n\n## Projects using nbb-logseq\n\n* https://github.com/logseq/graph-validator - github action to validate graph\n* https://github.com/cldwalker/logseq-query - commandline tool\n* https://github.com/logseq/bb-tasks#logseqbb-tasksnbb - bb tasks that use nbb-logseq\n* https://github.com/dom8509/logseq-to-markdown - CLI to export graph to Hugo Markdown files\n* https://github.com/logseq/docs/tree/master/script - Scripts to query docs\n* https://github.com/logseq/rdf-export - github action to export graph to RDF\n* For more examples see the [examples directory](examples).\n\n## CLIs\n\nStarting with version 1.2.168, `nbb-logseq` supports publishing node CLIs with\na `nbb.edn`. This means that it's possible to write a script that uses [logseq's\ngraph-parser](https://github.com/logseq/logseq/tree/master/deps/graph-parser)\nand share it with others so they can install it on their `$PATH`.\n\nCommunity CLIs with a `nbb.edn`:\n\n* [logseq-graph-ast](https://github.com/logseq/nbb-logseq/tree/main/examples/from-js#graph_astmjs) - CLI to print graph's ast data\n* [logseq-graph-validator](https://github.com/logseq/graph-validator#cli) - CLI to run validations on the current graph\n* [logseq-rdf-export](https://github.com/logseq/rdf-export#cli) - CLI to export graph as RDF\n* https://github.com/cldwalker/logseq-clis - Collection of CLIs to run on graphs\n* [nbb-logseq-test-runner](https://github.com/logseq-cldwalker/nbb-test-runner#cli) - CLI that runs\n  cljs.test tests for a nbb compatible project\n* [logseq-publish-spa](https://github.com/logseq/publish-spa#cli) - CLI that publishes a graph as a\n  single page app\n\nTo install or build a CLI locally, install\n[babashka](https://github.com/babashka/babashka#installation) and\n[clojure](https://clojure.org/guides/install_clojure).\n\n### Install a CLI\n\nFrom any script directory that has a `nbb.edn`, install CLIs on `$PATH` with\n`yarn global add $PWD` or `npm i -g`. If using `yarn` and `~/.yarn/bin` is not\non `$PATH`, add it to your shell's rc file e.g. `export\nPATH=\"$HOME/.yarn/bin:$PATH\"`.\n\n### Build a CLI\n\nTo convert a nbb-logseq cljs script into a CLI that others can install and use:\n\n* Create a wrapper `.mjs` file that invokes your nbb-logseq cljs script.\n  * Copy [the graph_ast.mjs example](examples/from-js/graph_ast.mjs) and change the cljs file inside it.\n* Add a `bin` entry to `package.json` that maps your CLI name to the cljs file.\n\nFor a tutorial on doing the above, read [nbb's publish\ndoc](https://github.com/babashka/nbb/tree/main/doc/publish).\n\n## Versioning\n\n`nbb-logseq` follows the same versioning as `nbb`. In other words, an 0.4.0 for\n`nbb-logseq` provides `nbb` 0.4.0 with the additional libraries.\n\n## Contributing\n\nExample contributions are welcome. For feature contributions, please discuss\nthem first as this is a low level library that will be relied on by multiple\nCLIs.\n\n## LICENSE\n\nSee LICENSE.md\n\n## Development\n\nThese sections for those developing this project.\n\n### QA local branch\n\nTo QA that your branch works as expected on a dependent repository e.g.\n[logseq/graph-parser](https://github.com/logseq/logseq/tree/master/deps/graph-parser):\n\n* `bb release` in this repo to build a local release.\n* `yarn add /path/to/nbb-logseq` in a dependent's repo.\n* 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`.\n\n### Release process\n\nSteps to publish a new npm package:\n\n1. Update CHANGELOG.md if anything specific to nbb-logseq has been updated.\n2. Update nbb with `bb update-nbb` on https://github.com/babashka/nbb-features and confirm CI passes.\n  * This is done to confirm that datascript and datascript-transit tests pass.\n3. Update nbb with `bb update-nbb` on this repo and confirm CI passes.\n  * This is done to run the test suite passes which includes cljs-time tests.\n4. Run `bb publish X.Y.Z` where X.Y.Z is the version to publish. Push to github to publish.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogseq%2Fnbb-logseq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogseq%2Fnbb-logseq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogseq%2Fnbb-logseq/lists"}