Skip to content

Build your personal knowledge base with Trilium Notes

fix(ci): failing due to electron-rebuild

Elian Doranb3dfdacdc387
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index a269174a77..8cd58460d2 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -26,7 +26,7 @@ jobs:
- uses: pnpm/action-setup@v4
- name: Install dependencies
- run: pnpm install --filter website... --frozen-lockfile
+ run: pnpm install --filter website --frozen-lockfile
- name: Build the website
run: pnpm website:build
diff --git a/scripts/electron-rebuild.mts b/scripts/electron-rebuild.mts
index 6ed8360e73..b2d41aa88a 100644
--- a/scripts/electron-rebuild.mts
+++ b/scripts/electron-rebuild.mts
@@ -1,5 +1,5 @@
import { join, resolve } from "path";
-import { cpSync, existsSync, mkdirSync, readFileSync, rmSync } from "fs";
+import { cpSync, exists, existsSync, mkdirSync, readFileSync, rmSync } from "fs";
import { execSync } from "child_process";
import { rebuild } from "@electron/rebuild"
import { getElectronPath, isNixOS } from "./utils.mjs";
@@ -12,8 +12,15 @@ function copyNativeDependencies(projectRoot: string) {
if (existsSync(destPath)) {
rmSync(destPath, { recursive: true });
}
- mkdirSync(destPath);
- cpSync(join(workspaceRoot, "node_modules/better-sqlite3"), destPath, { recursive: true, dereference: true });
+ mkdirSync(destPath, { recursive: true });
+
+ const sourcePath = join(workspaceRoot, "node_modules/better-sqlite3");
+ if (!existsSync(sourcePath)) {
+ console.warn("Nothing to rebuild as source path is missing:", sourcePath);
+ console.info("For CI builds with filtered package installs, this is normal. For normal development, it's not.");
+ process.exit(0);
+ }
+ cpSync(sourcePath, destPath, { recursive: true, dereference: true });
}
function rebuildNativeDependencies(projectRoot: string) {