PKM-er / obsidian-zotlit

A third-party project that aims to facilitate the integration between Obsidian.md and Zotero, by providing a set of community plugins for both Obsidian and Zotero.
https://zotlit.aidenlx.top
MIT License
647 stars 29 forks source link

Some hints on how to build? #340

Open jakobw123 opened 5 months ago

jakobw123 commented 5 months ago

Hey,

I am currently trying to build this project in order to add support for loading ink annotations (added with Zotero 7 Beta, similar to image annotations) as well as adding directories to the filename, which has been discussed and implemented here.

As I am totally new to the field of JS, TS and rushjs, I do not fully understand the build process. Even though you stated that this project is not ready for contribution, I would very much appreciate if you could give me a couple of hints on how to successfully build this project.

Atm I am doing the following:

  1. Installed Node.js (and npm) via nvm (Node Version Manager), Version: Node.js: 18.20.2, npm: 10.5.0
  2. Cloning & Submodule Init/Update
  3. npm install @microsoft/rush
  4. npm install
  5. rush update, which gives me some dependency errors:
    
    monkey-around
    ^2.3.0
        @aidenlx/workerpool
        @aidenlx/zotero-helper
        @obzt/common
        zotero-obsidian-note
        zotlit
    ^2.3
        @ophidian/core

obsidian 1.2.8 @ophidian/core 1.4.4 zotlit


5. Hacky fix: 
    - monkey-around: Change 2.3 to 2.3.0 in _ophidian-lib-core/package.json_
    - obsidian: Change 1.4.4 to 1.2.8 in _obsidian/package.json_
7. Hacky 'something' for _ophidian/core_ which probably is not the correct workflow, but without it running ```rush build``` returns with an error saying that there is no build instruction in the _scripts_ section of the _package.json_ file. 
Added following to _ophidian-lib-core/package.json_:

"scripts": { "dev": "node ophidian.config.mjs dev", "build": "node ophidian.config.mjs production" },


- I feel like this is not the way one is supposed to use _ophidian-lib-core_. It also obviously explains the missing file error below. But I will leave the details in here to show what my current 'progress' of building this plugin is.

9. ```rush build``` is successful for everything but _ophidian/core_ and _zotero-obsidian-note_. Errors are logged as follows:

For _ophidian/core_: 

node:internal/modules/cjs/loader:1143 throw err; ^

Error: Cannot find module '//obsidian-zotlit/lib/ophidian-lib-core/ophidian.config.mjs' at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15) at Module._load (node:internal/modules/cjs/loader:981:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: []

Node.js v18.20.2 Returned error code: 1 "@ophidian/core" failed to build. "zotlit" is blocked by "@ophidian/core". }

For _zotero-obsidian-note_:

sh: 1: zt-build: not found Returned error code: 127 "zotero-obsidian-note" failed to build.

Fail of _zotero-obsidian-note_ is probably caused by a fail in the ```rush update``` command:

 WARN  Failed to create bin at //obsidian-zotlit/app/zotero/node_modules/.bin/zt-dev. ENOENT: no such file or directory, open '//obsidian-zotlit/lib/zotero-helper/dist/scripts/dev.js'  WARN  Failed to create bin at //obsidian-zotlit/app/zotero/node_modules/.bin/zt-build. ENOENT: no such file or directory, open '//obsidian-zotlit/lib/zotero-helper/dist/scripts/build.js'  WARN  Failed to create bin at //obsidian-zotlit/app/zotero/node_modules/.bin/zt-dev. ENOENT: no such file or directory, open '//obsidian-zotlit/app/zotero/node_modules/@aidenlx/zotero-helper/dist/scripts/dev.js'  WARN  Failed to create bin at //obsidian-zotlit/app/zotero/node_modules/.bin/zt-build. ENOENT: no such file or directory, open '//obsidian-zotlit/app/zotero/node_modules/@aidenlx/zotero-helper/dist/scripts/build.js'  WARN  Issues with peer dependencies found ../../lib/components └─┬ class-variance-authority 0.4.0 └── ✕ unmet peer typescript@">= 4.5.5 < 5": found 5.1.6