chore(docs): restructure developer guide for monorepo

This commit is contained in:
Elian Doran
2025-05-02 20:51:13 +03:00
parent 27d1948bb1
commit 81ebbb9390
111 changed files with 2632 additions and 2202 deletions

View File

@@ -1,26 +0,0 @@
# Build deliveries locally
In the project root:
<figure class="table"><table><thead><tr><th>Platform</th><th>Architecture</th><th>Application</th><th>Build command</th></tr></thead><tbody><tr><th>macOS</th><td>x86_64</td><td>Desktop / Electron app</td><td><code>./bin/build-mac-x64.sh</code></td></tr><tr><td>ARM 64</td><td>Desktop / Electron app</td><td><code>./bin/build-mac-arm64.sh</code></td></tr><tr><th>Linux</th><td>x86_64</td><td>Desktop / Electron app</td><td><code>./bin/build-linux-x64.sh</code></td></tr><tr><td>Server</td><td><code>./bin/build-server.sh</code></td></tr><tr><th>Windows</th><td>x86_64</td><td>Desktop / Electron app</td><td><code>./bin/build-win-x64.sh</code></td></tr></tbody></table></figure>
Under NixOS the following `nix-shell` is needed:
```
nix-shell -p jq
```
For Linux builds:
```
nix-shell -p jq fakeroot dpkg
```
The resulting build will be in the `dist` directory under the project root.
### Testing the Linux builds under NixOS
<figure class="table"><table><thead><tr><th>Desktop client</th><th>Server</th></tr></thead><tbody><tr><td><pre><code class="language-text-plain">$ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p steam-run
[nix-shell] cd dist/trilium-linux-x64
[nix-shell] steam-run ./trilium</code></pre></td><td><pre><code class="language-text-plain">$ NIXPKGS_ALLOW_UNFREE=1 nix-shell -p steam-run
[nix-shell] cd dist/trilium-linux-x64-server
[nix-shell] steam-run ./trilium.sh</code></pre></td></tr></tbody></table></figure>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -1,24 +0,0 @@
# Main
The main workflow of the CI:
* Builds the Docker image and publishes in the GitHub Docker registry.
* Builds using a portion of the [delivery script](../Build%20deliveries%20locally.md) artifacts for the following platforms:
* Windows `x86_64` as .zip file
* Windows `x86_64` installer (using Squirrel)
* macOS `x86_64` and `aarch64`.
* Linux `x86_64`
* Linux server `x86_64`.
The main workflow of the CI runs on `develop` branches as well as any branch that starts with `feature/update_`.
## Downloading the artifacts from the main branch
Simply go to the [`develop` branch on GitHub](https://github.com/TriliumNext/Notes) and look at the commit bar:
<figure class="image"><img src="Main_image.png"></figure>
Press the green checkmark (or red cross if something went bad). Then look at the list of jobs and their status:
<figure class="image"><img src="1_Main_image.png"></figure>
Then look for any of the entires that starts with “Main” and press the “Details” link next to it. It doesn't really matter which platform you'll choose as the artifacts are available on the same page.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

View File

@@ -1,34 +0,0 @@
# Documentation
Development notes are published on [triliumnext.github.io/Notes](https://triliumnext.github.io/Notes) by the CI using GitHub Pages.
The GitHub Pages deployment works by taking the files from the Notes repository, in the `docs` directory.
## How it works
There is a script that uses `wget` to download all the files from a share, that means:
1. You must have a local instance of Trilium Notes server.
2. You must have the documentation imported, up to date and shared.
Note that currently the documentation source file is not distributed (the note export), until a way is found to automate this process. Contact `eliandoran` should you require to obtain a copy of the documentation.
## Setting up `.env` file
Go to `bin/docs` and copy `.env.example` to `.env` and edit it:
1. Change the `SHARE_PROTOCOL` to either `http` or `https` depending on your setup.
2. Change `SHARE_HOST` to match the domain name or the URL to the host (without the protocol or any slashes).
Generally `ROOT_NOTE_ID` should not be changed since the note ID must match if the files were imported correctly.
## Triggering a build
Run:
```
./bin/docs/prepare.sh
```
This will attempt to download all the notes from the share URL and put them in `docs`, rewritten for GitHub Pages.
Commit the results and follow the normal development process to push them.

View File

@@ -1,22 +0,0 @@
# Releasing a version
On NixOS:
```
nix-shell -p dpkg fakeroot jq nodejs_20
```
Then simply run from project root:
```
./bin/release.sh 1.2.3
```
where `1.2.3` is the desired release version.
If a version ends with `-beta`, it will automatically be marked as pre-release in GitHub.
This will automatically generate a release in GitHub if everything goes according to plan.
Note that the Windows installer is not automatically uploaded yet, it has to be taken from the [main workflow of the CI from the `develop` branch](CI/Main.md).
Make sure to check test the artifacts of the release.

View File

@@ -1,89 +0,0 @@
# Running a development build
As always, install the dependencies for the first time (and re-run whenever there are errors about missing dependencies):
```
npm install
```
## Run server
Run with default settings:
```
npm run start-server
```
Run with custom port:
```
TRILIUM_PORT=8082 npm run start-server
```
## Run Electron
Rebuild `better-sqlite3` dependency:
```
npm run switch-electron
```
Then run Electron:
```
npm run start-electron
```
To run Electron using the same data directory as the production version:
```
npm run start-electron-no-dir
```
When done, switch back the `better-sqlite3` dependency:
```
npm run switch-server
```
## Quick switch
To start Electron without running `switch-electron` first:
```
npm run qstart-electron
```
Similarly, to start the server without running `switch-server` first:
```
npm run qstart-server
```
## Safe mode
Safe mode is off by default, to enable it temporarily on a Unix shell, prepend the environment variable setting:
```
TRILIUM_SAFE_MODE=1 npm run start-server
```
To have the same behaviour on Windows, we would need to alter `package.json`:
```diff
-"start-electron": "npm run prepare-dist && cross-env TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron-main.js --inspect=5858 .",
+"start-electron": "npm run prepare-dist && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron-main.js --inspect=5858 .",
```
## Running on NixOS
When doing development, the Electron binary retrieved from NPM is not going to be compatible with NixOS, resulting in errors when trying to run it. To bypass this, there is a special command to run electron using `nix-shell`:
```
npm run start-electron-nix
```
Similarly to the original command, to use the same data directory as the production version:
```
npm run start-electron-no-dir-nix
```