fix(edit-docs): get Electron to actually start

This commit is contained in:
Elian Doran 2025-05-01 17:22:26 +03:00
parent b72e7339c8
commit 385182cd97
No known key found for this signature in database
5 changed files with 41 additions and 26 deletions

View File

@ -31,7 +31,20 @@ async function main() {
}
});
electron.app.on("ready", async () => {
electron.app.on("ready", onReady);
electron.app.on("will-quit", () => {
electron.globalShortcut.unregisterAll();
});
// this is to disable electron warning spam in the dev console (local development only)
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
await initializeTranslations();
await import("@triliumnext/server/src/main.js");
}
export async function onReady() {
// electron.app.setAppUserModelId('com.github.zadam.trilium');
// if db is not initialized -> setup process
@ -55,17 +68,6 @@ async function main() {
}
await windowService.registerGlobalShortcuts();
});
electron.app.on("will-quit", () => {
electron.globalShortcut.unregisterAll();
});
// this is to disable electron warning spam in the dev console (local development only)
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
await initializeTranslations();
await import("@triliumnext/server/src/main.js");
}
main();

View File

@ -13,6 +13,8 @@ import TaskContext from "@triliumnext/server/src/services/task_context.js";
import { deferred } from "@triliumnext/server/src/services/utils.js";
import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help.js";
import { resolve } from "path";
import electron from "electron";
import { onReady } from "@triliumnext/desktop/src/electron-main.js";
interface NoteMapping {
rootNoteId: string;
@ -53,6 +55,8 @@ const NOTE_MAPPINGS: NoteMapping[] = [
];
async function main() {
electron.app.on("ready", onReady);
await initializeTranslations();
await initializeDatabase(true);
@ -68,7 +72,6 @@ async function main() {
});
await initializedPromise;
await startElectron();
// Wait for the import to be finished and the application to be loaded before we listen to changes.
setTimeout(() => registerHandlers(), 10_000);

View File

@ -18,6 +18,9 @@
"eslint.config.mjs"
],
"references": [
{
"path": "../server/tsconfig.app.json"
},
{
"path": "../desktop/tsconfig.app.json"
},

View File

@ -3,6 +3,9 @@
"files": [],
"include": [],
"references": [
{
"path": "../server"
},
{
"path": "../desktop"
},

View File

@ -35,6 +35,10 @@ module.exports = {
from: "../desktop/dist/assets",
to: join(outputDir, "assets")
},
{
from: "../desktop/dist/public",
to: join(outputDir, "public")
},
]
})
],