Development

林一二2023年06月01日 22:46

Development guide

Development plan of TidGi-Desktop is listed in these Kanban.

Explanation of our code can be found in the Wiki.

To contribute, fork this repo, then clone it and setup development environment

# First, clone the project:
git clone https://github.com/YOUR_ACCOUNT/TidGi-Desktop.git
cd TidGi-Desktop

# Or maybe you are just using Github Desktop

# or GitKraken to clone this repo,

# and open it in your favorite code editor and terminal app

# switch to the nodejs version same as electron used version, other wise you may get

# Error: The module '/Users/linonetwo/Desktop/repo/TidGi-Desktop/node_modules/opencv4nodejs-prebuilt/build/Release/opencv4nodejs.node'

# was compiled against a different Node.js version using

# NODE_MODULE_VERSION 88. This version of Node.js requires

# NODE_MODULE_VERSION 93. Please try re-compiling or re-installing

# the module (for instance, using `npm rebuild` or `npm install`).

# See https://github.com/justadudewhohacks/opencv4nodejs/issues/401#issuecomment-463434713 if you still have problem rebuild opencv for @nut-tree/nut-js
nvm use

# install the dependencies
npm i

# Run development mode

# You can see webpack error messages in http://localhost:9000/
npm start

# Build for production
npm run package

Publish

Add a tag like vx.x.x to a commit, and push it to the origin, Github will start building App for all three platforms.

After Github Action completed, you can open Releases to see the Draft release created by Github, add some comment and publish it.

How to add dependency that used in a worker_thread

For example: tiddlywiki

  1. npm i tiddlywiki
  2. Add ExternalsPlugin in webpack.plugins.js (maybe optional for some deps, tiddlywiki needs this because its custom require can't require things that is bundled by webpack. dugite don't need this step)
  3. Add a await fs.copy(path.join(projectRoot, 'node_modules/@tiddlygit/tiddlywiki') in scripts/afterPack.js , to copy things to resource folder, that is outside of asar, so it can be used by the worker_thread in electron

How to add plugin that only execute inside TidGi

Edit src/services/wiki/wikiWorker.ts, add another line like:

wikiInstance.boot.argv = [
  '+plugins/tiddlywiki/filesystem',
  '+plugins/tiddlywiki/tiddlyweb',

Code Tour

TBD