diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml
index b55ffea4b..76e8161b5 100644
--- a/.github/actions/build-electron/action.yml
+++ b/.github/actions/build-electron/action.yml
@@ -33,10 +33,10 @@ runs:
run: sed -e "s/case 'armv7l'/case 'arm64'/g" -e "s/return 'arm'/return 'aarch64'/g" -i node_modules/@electron-forge/maker-flatpak/dist/MakerFlatpak.js
- name: Update build info
shell: bash
- run: npm run update-build-info
+ run: npm run chore:update-build-info
- name: Run electron-forge
shell: bash
- run: npm run make-electron -- --arch=${{ inputs.arch }}
+ run: npm run electron-forge:make -- --arch=${{ inputs.arch }}
- name: Prepare artifacts
shell: bash
run: |
diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml
index 694005c1b..cf8057c70 100644
--- a/.github/actions/build-server/action.yml
+++ b/.github/actions/build-server/action.yml
@@ -18,7 +18,7 @@ runs:
MATRIX_ARCH: ${{ inputs.arch }}
shell: bash
run: |
- npm run update-build-info
+ npm run chore:update-build-info
./bin/build-server.sh
- name: Prepare artifacts
shell: bash
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 2b1fbe57e..f7cee700a 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -38,7 +38,7 @@ jobs:
shell: bash
run: npm ci
- name: Update nightly version
- run: npm run ci-update-nightly-version
+ run: npm run chore:ci-update-nightly-version
- name: Run the build
uses: ./.github/actions/build-electron
with:
diff --git a/.gitpod.yml b/.gitpod.yml
index 2b77be7b7..f87a115d0 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -4,7 +4,7 @@ image:
tasks:
- before: nvm install 20.15.1 && nvm use 20.15.1
init: npm install
- command: npm run start-server
+ command: npm run server:start
ports:
- port: 8080
diff --git a/Dockerfile b/Dockerfile
index d2ceb1c91..365e4d07f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,7 +25,7 @@ RUN cp -R build/src/* src/. && \
cp build/docker_healthcheck.js . && \
rm docker_healthcheck.ts && \
npm install && \
- npm run webpack && \
+ npm run build:webpack && \
npm prune --omit=dev && \
npm cache clean --force && \
cp -r src/public/app/doc_notes src/public/app-dist/. && \
diff --git a/Dockerfile.alpine b/Dockerfile.alpine
index a506193eb..36d6f0b7b 100644
--- a/Dockerfile.alpine
+++ b/Dockerfile.alpine
@@ -24,7 +24,7 @@ RUN cp -R build/src/* src/. && \
cp build/docker_healthcheck.js . && \
rm docker_healthcheck.ts && \
npm install && \
- npm run webpack && \
+ npm run build:webpack && \
npm prune --omit=dev && \
npm cache clean --force && \
cp -r src/public/app/doc_notes src/public/app-dist/. && \
diff --git a/README-ZH_CN.md b/README-ZH_CN.md
index f6aa860b1..1f6bbaf55 100644
--- a/README-ZH_CN.md
+++ b/README-ZH_CN.md
@@ -78,7 +78,7 @@ Trilium 也提供 Flatpak:
```shell
npm install
-npm run start-server
+npm run server:start
```
## 👏 致谢
diff --git a/README.es.md b/README.es.md
index a2ea94144..bfa57fe45 100644
--- a/README.es.md
+++ b/README.es.md
@@ -86,7 +86,7 @@ Clone localmente y ejecute
```shell
npm install
-npm run start-server
+npm run server:start
```
## 👏 Reconocimientos
diff --git a/README.it.md b/README.it.md
index a778230c7..750027c1a 100644
--- a/README.it.md
+++ b/README.it.md
@@ -73,7 +73,7 @@ Clona localmente ed esegui
```shell
npm install
-npm run start-server
+npm run server:start
```
## 👏 Riconoscimenti
diff --git a/README.ja.md b/README.ja.md
index 110b779c5..757638770 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -54,7 +54,7 @@ Trilium は Flatpak としても提供されます:
```shell
npm install
-npm run start-server
+npm run server:start
```
## 📢 シャウトアウト
diff --git a/README.md b/README.md
index e2a81aa4c..0170c8135 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ You can also read [Patterns of personal knowledge base](https://triliumnext.gith
git clone https://github.com/TriliumNext/Notes.git
cd Notes
npm install
-npm run start-server
+npm run server:start
```
### Documentation
diff --git a/README.ru.md b/README.ru.md
index d78738915..e2336efb3 100644
--- a/README.ru.md
+++ b/README.ru.md
@@ -44,7 +44,7 @@ Trilium предоставляется в виде десктопного при
```shell
npm install
-npm run start-server
+npm run server:start
```
## 👏 Благодарности
diff --git a/bin/copy-trilium.sh b/bin/copy-trilium.sh
index 221e8a0ea..e1d0e197f 100755
--- a/bin/copy-trilium.sh
+++ b/bin/copy-trilium.sh
@@ -23,7 +23,7 @@ rm -rf "$DIR"
mkdir -pv "$DIR"
echo Webpack start
-npm run webpack
+npm run build:webpack
echo Webpack finish
echo "Copying Trilium to build directory $DIR"
diff --git a/bin/release.sh b/bin/release.sh
index fea1e030f..74559a88c 100755
--- a/bin/release.sh
+++ b/bin/release.sh
@@ -32,7 +32,7 @@ mv package.json.tmp package.json
git add package.json
-npm run update-build-info
+npm run chore:update-build-info
git add src/services/build.ts
diff --git a/docs/X4N03xLYEWnN.html b/docs/X4N03xLYEWnN.html
index 2b686480d..b8e844cba 100644
--- a/docs/X4N03xLYEWnN.html
+++ b/docs/X4N03xLYEWnN.html
@@ -38,12 +38,12 @@
-
The native node bindings
better-sqlite3 has native Node bindings. With updates of better-sqlite3, but also of Electron and Node.js versions, these bindings need to be updated.
Note that Electron and Node.js versions need different versions of these bindings, since Electron usually packs a different version of Node.js.
During development, npm install tries to build or reuse prebuilt natives for the current Node.js version. This makes npm run start-server work out of the box. Trying to run npm run start-electron with these versions generally causes an error such as this:
Uncaught Exception:
+
The native node bindings
better-sqlite3 has native Node bindings. With updates of better-sqlite3, but also of Electron and Node.js versions, these bindings need to be updated.
Note that Electron and Node.js versions need different versions of these bindings, since Electron usually packs a different version of Node.js.
During development, npm install tries to build or reuse prebuilt natives for the current Node.js version. This makes npm run server:start work out of the box. Trying to run npm run electron:start with these versions generally causes an error such as this:
Uncaught Exception:
Error: The module '/Users/elian/Projects/Notes/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 116. Please try re-compiling or re-installing
-the module (for instance, using `npm rebuild` or `npm install`).
How the natives are handled
Locally, this can be fixed by rebuilding the binaries, which is what npm run switch-electron does, which uses electron-rebuild under the hood.
When the deliveries are built (see Build deliveries locally), it is not feasible to rebuild the dependencies since we are building for multiple platforms. Luckily, better-sqlite3 provides these prebuilt binaries from us, available as artifacts on their GitHub releases page.
The build script manages the natives for better-sqlite3 by keeping a copy of the .node file for every platform in bin/better-sqlite3.
Whenever the version of better-sqlite3 changes, the .node files must also be renewed based on their releases page. To simplify this process, a script was created in bin/better-sqlite3/update.sh.
How to update the natives
The update script needs to know the version of Electron or Node.js for which to download the prebuilt binaries.
If you get errors during download, check on the releases page to ensure that this particular combination of Electron/Node actually exists for the given release.
To determine the NODE_MODULE_VERSION that is required, look for This version of Node.js requires NODE_MODULE_VERSION in the error when starting Trilium via:
npm run start-electron (or run any Electron delivery), case in which the ELECTRON_VERSION variable needs to be changed.
npm run start-server (or run the Linux server delivery), case in which the NODE_VERSION variable needs to be changed.
Check which files got changed after running the update script and for each platform that got changed, test it locally via Build deliveries locally or via the CI.
+the module (for instance, using `npm rebuild` or `npm install`).
How the natives are handled
Locally, this can be fixed by rebuilding the binaries, which is what npm run electron:switch does, which uses electron-rebuild under the hood.
When the deliveries are built (see Build deliveries locally), it is not feasible to rebuild the dependencies since we are building for multiple platforms. Luckily, better-sqlite3 provides these prebuilt binaries from us, available as artifacts on their GitHub releases page.
The build script manages the natives for better-sqlite3 by keeping a copy of the .node file for every platform in bin/better-sqlite3.
Whenever the version of better-sqlite3 changes, the .node files must also be renewed based on their releases page. To simplify this process, a script was created in bin/better-sqlite3/update.sh.
How to update the natives
The update script needs to know the version of Electron or Node.js for which to download the prebuilt binaries.
If you get errors during download, check on the releases page to ensure that this particular combination of Electron/Node actually exists for the given release.
To determine the NODE_MODULE_VERSION that is required, look for This version of Node.js requires NODE_MODULE_VERSION in the error when starting Trilium via:
npm run electron:start (or run any Electron delivery), case in which the ELECTRON_VERSION variable needs to be changed.
npm run server:start (or run the Linux server delivery), case in which the NODE_VERSION variable needs to be changed.
Check which files got changed after running the update script and for each platform that got changed, test it locally via Build deliveries locally or via the CI.
If running the server using npm run start-server, the server will watch for changes in src/public and trigger a frontend reload if that occurs.
Electron live reload
Similarly, npm run start-electron supports live refresh as well.
However, a core difference is that Electron watches dist/src/public instead of src/public since Electron runs on its own copy of the files.
To ameliorate that, a separate watch script has been implemented which automatically copies files from src/public to dist/src/public whenever a change is detected. To run it:
npm run
Technical details
This mechanism is managed at server level by watching for changes inservices/ws.ts.
+
Server live reload
If running the server using npm run server:start, the server will watch for changes in src/public and trigger a frontend reload if that occurs.
Electron live reload
Similarly, npm run electron:start supports live refresh as well.
However, a core difference is that Electron watches dist/src/public instead of src/public since Electron runs on its own copy of the files.
To ameliorate that, a separate watch script has been implemented which automatically copies files from src/public to dist/src/public whenever a change is detected. To run it:
npm run
Technical details
This mechanism is managed at server level by watching for changes inservices/ws.ts.
Provides context about when the build was made and the corresponding Git revision.
The information is displayed to the client when going in the about dialog.
The build information is hard-coded in src/services/build.ts. This file is generated automatically via npm run update-build-info which itself is run automatically whenever making a build in the CI, or a local delivery.
+
Provides context about when the build was made and the corresponding Git revision.
The information is displayed to the client when going in the about dialog.
The build information is hard-coded in src/services/build.ts. This file is generated automatically via npm run chore:update-build-info which itself is run automatically whenever making a build in the CI, or a local delivery.