logseq / bb-tasks

Reusable babashka tasks used by logseq team

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find logseq.graph-parser.cli.

Bad3r opened this issue Β· comments

commented

Hey there πŸ‘‹,
I am testing bb-task in a local env. I am using the repo to make it easier to reproduce.
The folder structure is as follows:

test
β”œβ”€β”€ bb-tasks
└── logseq
    └── deps
       β”œβ”€β”€ common
       β”œβ”€β”€ db
       └── graph-parser

This is a newly cloned bb-tasks repo without any modifications.

Inside the bb-tasks directory, I ran one of the examples with a test journal file:

❯ bb examples/analyze_file.cljs ~/graph/journals/2021-06-14.md

THe script returned the error:

----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Could not find namespace: logseq.graph-parser.cli.
Location: /test/bb-tasks/examples/analyze_file.cljs:4:3

----- Context ------------------------------------------------------------------
1: (ns analyze-file
2:   "This is an example script for use with logseq.bb-tasks.nbb.watch/watch.
3: It demonstrates some basic stats that could be useful to see for a file"
4:   (:require [logseq.graph-parser.cli :as gp-cli]
     ^--- Could not find namespace: logseq.graph-parser.cli.
5:             [clojure.pprint :as pprint]
6:             [datascript.core :as d]))
7: 
8: (defn- colorize-or-pretty-print
9:   [results]

----- Stack trace --------------------------------------------------------------
analyze-file - /test/bb-tasks/examples/analyze_file.cljs:4:3

The error indicates that the analyze_file.cljs script couldn't find the logseq.graph-parser.cli namespace. The namespace is defined in bb.edn as follows:

 ;; For example nbb scripts
 {#_logseq/graph-parser
  #_{:local/root "../logseq/deps/graph-parser"}
  local/deps
  {:local/root "."}}

The path checks out, and the graph parser directory exists at that path.

❯ exa -haglF ../logseq/deps/graph-parser 
Permissions Size User  Group Date Modified Name
drwxr-xr-x     - auser users 20 Mar 07:43  .carve/
drwxr-xr-x     - auser users 10 Mar 20:32  .clj-kondo/
.rw-r--r--    51 auser users 10 Mar 20:31  .gitignore
.rw-r--r--   653 auser users 10 Mar 20:32  bb.edn
.rw-r--r--  1.1k auser users 10 Mar 20:32  deps.edn
.rw-r--r--   307 auser users 19 Mar 11:00  package.json
.rw-r--r--  2.2k auser users 19 Mar 11:00  README.md
drwxr-xr-x     - auser users 10 Mar 20:31  src/
drwxr-xr-x     - auser users 10 Mar 20:31  test/
.rw-r--r--   16k auser users 19 Mar 11:00  yarn.lock

Any pointers or hints on how can I solve this issue?
Sorry if I am missing something obvious. πŸ™Š

Hi @Bad3r. cljs files are run by nbb-logseq instead of bb. An easy rule of thumb to remember is cljs files are run with nbb-logseq and {.clj,.cljc} are run by bb. There are some setup instructions in https://github.com/logseq/bb-tasks#logseqbb-tasksnbbwatch. If you're not familiar with bb and nbb, I'd recommend running some of the easier tasks like the ones that start with lint: in the logseq codebase

commented

oh, that makes sense πŸ˜…
Thank you for clarifying. I'll get more familiar with nbb-logseq.
I'll start by testing the linting and carving tasks against the Logseq codebase.