Files
logseq/deps/db/script/dump_datoms.cljs
megayu 79c25837cb Migrate from yarn to pnpm (#12529)
* migrate yarn to pnpm

* chore: update pnpm version to 10.33.0 across all package.json files

* chore: update .npmrc and package.json for improved dependency management

* chore: unify Clojure, Node, and Java version in workflow files

* fix: enable shamefully-hoist for now and add electron, keytar to onlyBuiltDependencies

* feat: add cider/piggieback dependency and update nREPL middleware configuration to silence warnings

* ensure pnpm setup prior to node setup

* fix: update logseq/bb-tasks git SHA

* feat: add pnpm configuration for onlyBuiltDependencies in package.json

* feat: add onlyBuiltDependencies configuration for better-sqlite3 in pnpm settings

* chore: update pnpm lockfile

* fix: resolve merge conflicts

* fix: remove invisible characters from markdown headers

* fix: update .npmrc comments for clarity on lockfile usage

* Revert "feat: add cider/piggieback dependency and update nREPL middleware configuration to silence warnings"

This reverts commit 70a111936f.

* fix: remove invisible characters from various README files and add .editorconfig

* fix: clarify lockfile resolution process in SKILL.md

---------

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
2026-04-24 23:40:25 +08:00

26 lines
970 B
Clojure

(ns dump-datoms
"A script that dumps all eavt datoms to a specified edn file
$ pnpm exec nbb-logseq script/dump_datoms.cljs db-name datoms.edn"
(:require ["fs" :as fs]
["path" :as node-path]
[clojure.pprint :as pprint]
[datascript.core :as d]
[logseq.db.common.sqlite-cli :as sqlite-cli]
[nbb.core :as nbb]))
(defn -main [args]
(when (< (count args) 2)
(println "Usage: $0 GRAPH FILE")
(js/process.exit 1))
(let [[graph-name file*] args
conn (apply sqlite-cli/open-db! (sqlite-cli/->open-db-args graph-name))
datoms (mapv #(vec %) (d/datoms @conn :eavt))
parent-dir (or js/process.env.ORIGINAL_PWD ".")
file (node-path/join parent-dir file*)]
(println "Writing" (count datoms) "datoms to" file)
(fs/writeFileSync file (with-out-str (pprint/pprint datoms)))))
(when (= nbb/*file* (nbb/invoked-file))
(-main *command-line-args*))