From 61b7d887ccd93fc9c350cfbd14c28c83cf28c669 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 7 Feb 2025 23:26:25 +0200 Subject: [PATCH 1/3] chore(deps): update electron to 34.1.1 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c945393fe..4e4581688 100644 --- a/package-lock.json +++ b/package-lock.json @@ -153,7 +153,7 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.1.0", + "electron": "34.1.1", "esm": "3.2.25", "jasmine": "5.5.0", "jsdoc": "4.0.4", @@ -7910,9 +7910,9 @@ } }, "node_modules/electron": { - "version": "34.1.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-34.1.0.tgz", - "integrity": "sha512-ZUid8XrGPA0dfes97PPADc8ecWOUX/qYRNp1glze9coZLEYc+PsMvgjVDCHSvjfHfiI+V3unwngSVpBouX71YQ==", + "version": "34.1.1", + "resolved": "https://registry.npmjs.org/electron/-/electron-34.1.1.tgz", + "integrity": "sha512-1aDYk9Gsv1/fFeClMrxWGoVMl7uCUgl1pe26BiTnLXmAoqEXCa3f3sCKFWV+cuDzUjQGAZcpkWhGYTgWUSQrLA==", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 47b2337a1..056d3b602 100644 --- a/package.json +++ b/package.json @@ -195,7 +195,7 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.1.0", + "electron": "34.1.1", "esm": "3.2.25", "jasmine": "5.5.0", "jsdoc": "4.0.4", From 7f314d2d75e4682a4c9c14e2b400364f49b015c2 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Feb 2025 00:20:55 +0200 Subject: [PATCH 2/3] feat(build): set up webpack cache --- .gitignore | 1 + src/routes/assets.ts | 8 +++++++- src/services/in_app_help.ts | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bbfb24483..bc1575665 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.cache .DS_Store node_modules/ dist/ diff --git a/src/routes/assets.ts b/src/routes/assets.ts index e76f0fc88..96916f85d 100644 --- a/src/routes/assets.ts +++ b/src/routes/assets.ts @@ -2,7 +2,7 @@ import assetPath from "../services/asset_path.js"; import path from "path"; import { fileURLToPath } from "url"; import express from "express"; -import { isDev } from "../services/utils.js"; +import { isDev, isElectron } from "../services/utils.js"; import type serveStatic from "serve-static"; const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions>>) => { @@ -24,6 +24,12 @@ async function register(app: express.Application) { const frontendCompiler = webpack({ mode: "development", + cache: { + type: "filesystem", + cacheDirectory: isElectron + ? path.join(srcRoot, "..", "..", ".cache", "electron") + : path.join(srcRoot, "..", ".cache", "server") + }, entry: productionConfig.entry, module: productionConfig.module, resolve: productionConfig.resolve, diff --git a/src/services/in_app_help.ts b/src/services/in_app_help.ts index c06d15bd8..0af911684 100644 --- a/src/services/in_app_help.ts +++ b/src/services/in_app_help.ts @@ -28,7 +28,6 @@ function parseNoteMetaFile(noteMetaFile: NoteMetaFile): HiddenSubtreeItem[] { const metaRoot = noteMetaFile.files[0]; const parsedMetaRoot = parseNoteMeta(metaRoot, "/" + (metaRoot.dirFileName ?? "")); - console.log(JSON.stringify(parsedMetaRoot, null, 4)); return parsedMetaRoot.children ?? []; } From a1c97142a841ab82ce357b43b027efd2b0447398 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Feb 2025 00:41:31 +0200 Subject: [PATCH 3/3] feat(build): set up faster electron build by skipping dist --- package.json | 14 ++++++++++---- src/routes/assets.ts | 4 +--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 056d3b602..a2c9bcb7d 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,16 @@ "start-server-no-dir": "cross-env TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/main.ts", "start-test-server": "npm run switch-server && rimraf ./data-test && cross-env TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 nodemon src/main.ts", "qstart-server": "npm run switch-server && npm run start-server", - "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-nix": "electron-rebuild --version 33.3.1 && npm run prepare-dist && cross-env TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./dist/electron-main.js --inspect=5858 .\"", - "start-electron-no-dir": "npm run prepare-dist && cross-env TRILIUM_ENV=dev electron --inspect=5858 .", - "start-electron-no-dir-nix": "electron-rebuild --version 33.3.1 && npm run prepare-dist && cross-env TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./dist/electron-main.js --inspect=5858 .\"", + + "start-electron": "cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./electron-main.ts --inspect=5858 .", + "start-electron-nix": "electron-rebuild --version 33.3.1 && cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./electron-main.ts --inspect=5858 .\"", + "start-electron-no-dir": "cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_ENV=dev electron --inspect=5858 .", + "start-electron-no-dir-nix": "electron-rebuild --version 33.3.1 && cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./electron-main.ts --inspect=5858 .\"", + + "start-electron-prod": "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-prod-nix": "electron-rebuild --version 33.3.1 && npm run prepare-dist && cross-env TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./dist/electron-main.js --inspect=5858 .\"", + "start-electron-prod-no-dir": "npm run prepare-dist && cross-env TRILIUM_ENV=dev electron --inspect=5858 .", + "start-electron-prod-no-dir-nix": "electron-rebuild --version 33.3.1 && npm run prepare-dist && cross-env TRILIUM_ENV=dev nix-shell -p electron_33 --run \"electron ./dist/electron-main.js --inspect=5858 .\"", "qstart-electron": "npm run switch-electron && npm run start-electron", "switch-server": "rimraf ./node_modules/better-sqlite3 && npm install", "switch-electron": "electron-rebuild", diff --git a/src/routes/assets.ts b/src/routes/assets.ts index 96916f85d..b0a8ed354 100644 --- a/src/routes/assets.ts +++ b/src/routes/assets.ts @@ -26,9 +26,7 @@ async function register(app: express.Application) { mode: "development", cache: { type: "filesystem", - cacheDirectory: isElectron - ? path.join(srcRoot, "..", "..", ".cache", "electron") - : path.join(srcRoot, "..", ".cache", "server") + cacheDirectory: path.join(srcRoot, "..", ".cache", isElectron ? "electron" : "server") }, entry: productionConfig.entry, module: productionConfig.module,