| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | import path from "path"; | 
					
						
							|  |  |  | import fs from "fs-extra"; | 
					
						
							|  |  |  | import { LOCALES } from "@triliumnext/commons"; | 
					
						
							|  |  |  | import { PRODUCT_NAME } from "../src/app-info.js"; | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  | const ELECTRON_FORGE_DIR = __dirname; | 
					
						
							| 
									
										
										
										
											2025-04-26 01:09:28 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-19 11:47:57 +03:00
										 |  |  | const EXECUTABLE_NAME = "trilium"; // keep in sync with server's package.json -> packagerConfig.executableName
 | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  | const APP_ICON_PATH = path.join(ELECTRON_FORGE_DIR, "app-icon"); | 
					
						
							| 
									
										
										
										
											2024-08-11 06:57:34 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-05 09:33:33 +01:00
										 |  |  | const extraResourcesForPlatform = getExtraResourcesForPlatform(); | 
					
						
							| 
									
										
										
										
											2025-02-05 09:30:55 +01:00
										 |  |  | const baseLinuxMakerConfigOptions = { | 
					
						
							| 
									
										
										
										
											2025-04-19 12:00:58 +03:00
										 |  |  |   name: EXECUTABLE_NAME, | 
					
						
							| 
									
										
										
										
											2025-04-27 12:13:36 +03:00
										 |  |  |   bin: EXECUTABLE_NAME, | 
					
						
							| 
									
										
										
										
											2025-04-19 12:00:58 +03:00
										 |  |  |   productName: PRODUCT_NAME, | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  |   icon: path.join(APP_ICON_PATH, "png/128x128.png"), | 
					
						
							| 
									
										
										
										
											2025-04-26 09:58:42 +03:00
										 |  |  |   desktopTemplate: path.resolve(path.join(ELECTRON_FORGE_DIR, "desktop.ejs")), | 
					
						
							| 
									
										
										
										
											2025-02-07 08:57:20 +01:00
										 |  |  |   categories: ["Office", "Utility"] | 
					
						
							| 
									
										
										
										
											2025-02-05 09:30:55 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2025-03-24 17:53:04 +02:00
										 |  |  | const windowsSignConfiguration = process.env.WINDOWS_SIGN_EXECUTABLE ? { | 
					
						
							| 
									
										
										
										
											2025-04-26 09:58:42 +03:00
										 |  |  |     hookModulePath: path.join(ELECTRON_FORGE_DIR, "sign-windows.cjs") | 
					
						
							| 
									
										
										
										
											2025-03-24 17:53:04 +02:00
										 |  |  | } : undefined; | 
					
						
							| 
									
										
										
										
											2025-04-27 14:14:54 +03:00
										 |  |  | const macosSignConfiguration = process.env.APPLE_ID ? { | 
					
						
							|  |  |  |     osxSign: {}, | 
					
						
							|  |  |  |     osxNotarize: { | 
					
						
							|  |  |  |         appleId: process.env.APPLE_ID, | 
					
						
							|  |  |  |         appleIdPassword: process.env.APPLE_ID_PASSWORD, | 
					
						
							|  |  |  |         teamId: process.env.APPLE_TEAM_ID | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } : undefined; | 
					
						
							| 
									
										
										
										
											2025-02-05 09:30:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  | module.exports = { | 
					
						
							| 
									
										
										
										
											2025-04-25 17:46:50 +03:00
										 |  |  |     outDir: "out", | 
					
						
							| 
									
										
										
										
											2025-04-26 02:13:02 +03:00
										 |  |  |     // Documentation of `packagerConfig` options: https://electron.github.io/packager/main/interfaces/Options.html
 | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     packagerConfig: { | 
					
						
							| 
									
										
										
										
											2025-04-19 11:38:57 +03:00
										 |  |  |         executableName: EXECUTABLE_NAME, | 
					
						
							|  |  |  |         name: PRODUCT_NAME, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |         overwrite: true, | 
					
						
							|  |  |  |         asar: true, | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  |         icon: path.join(APP_ICON_PATH, "icon"), | 
					
						
							| 
									
										
										
										
											2025-04-27 14:14:54 +03:00
										 |  |  |         ...macosSignConfiguration, | 
					
						
							| 
									
										
										
										
											2025-03-24 17:04:22 +02:00
										 |  |  |         windowsSign: windowsSignConfiguration, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |         extraResource: [ | 
					
						
							| 
									
										
										
										
											2025-02-22 22:43:09 +00:00
										 |  |  |             // All resources should stay in Resources directory for macOS
 | 
					
						
							| 
									
										
										
										
											2025-04-26 01:09:28 +03:00
										 |  |  |             ...(process.platform === "darwin" ? [] : extraResourcesForPlatform) | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2025-04-27 20:58:15 +03:00
										 |  |  |         prune: false, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |         afterComplete: [ | 
					
						
							|  |  |  |             (buildPath, _electronVersion, platform, _arch, callback) => { | 
					
						
							| 
									
										
										
										
											2025-02-22 22:43:09 +00:00
										 |  |  |                 // Only move resources on non-macOS platforms
 | 
					
						
							|  |  |  |                 if (platform !== "darwin") { | 
					
						
							|  |  |  |                     for (const resource of extraResourcesForPlatform) { | 
					
						
							|  |  |  |                         const baseName = path.basename(resource); | 
					
						
							|  |  |  |                         const sourcePath = path.join(buildPath, "resources", baseName); | 
					
						
							| 
									
										
										
										
											2025-02-24 16:12:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         // prettier-ignore
 | 
					
						
							| 
									
										
										
										
											2025-02-22 22:43:09 +00:00
										 |  |  |                         const destPath = (baseName !== "256x256.png") | 
					
						
							|  |  |  |                             ? path.join(buildPath, baseName) | 
					
						
							|  |  |  |                             : path.join(buildPath, "icon.png"); | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-22 22:43:09 +00:00
										 |  |  |                         fs.move(sourcePath, destPath) | 
					
						
							|  |  |  |                             .then(() => callback()) | 
					
						
							|  |  |  |                             .catch((err) => callback(err)); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     callback(); | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ] | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     rebuildConfig: { | 
					
						
							| 
									
										
										
										
											2025-05-26 16:38:11 +03:00
										 |  |  |         force: true, | 
					
						
							|  |  |  |         extraModules: [ "better-sqlite3" ] | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     makers: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-deb", | 
					
						
							|  |  |  |             config: { | 
					
						
							| 
									
										
										
										
											2025-04-27 12:13:36 +03:00
										 |  |  |                 options: baseLinuxMakerConfigOptions | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2025-02-03 23:21:27 +01:00
										 |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-flatpak", | 
					
						
							|  |  |  |             config: { | 
					
						
							|  |  |  |                 options: { | 
					
						
							| 
									
										
										
										
											2025-02-07 08:52:55 +01:00
										 |  |  |                     ...baseLinuxMakerConfigOptions, | 
					
						
							| 
									
										
										
										
											2025-02-07 18:17:06 +02:00
										 |  |  |                     id: "com.triliumnext.notes", | 
					
						
							| 
									
										
										
										
											2025-02-05 08:32:59 +01:00
										 |  |  |                     runtimeVersion: "24.08", | 
					
						
							|  |  |  |                     base: "org.electronjs.Electron2.BaseApp", | 
					
						
							|  |  |  |                     baseVersion: "24.08", | 
					
						
							|  |  |  |                     baseFlatpakref: "https://flathub.org/repo/flathub.flatpakrepo", | 
					
						
							|  |  |  |                     modules: [ | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             name: "zypak", | 
					
						
							|  |  |  |                             sources: { | 
					
						
							|  |  |  |                                 type: "git", | 
					
						
							|  |  |  |                                 url: "https://github.com/refi64/zypak", | 
					
						
							|  |  |  |                                 tag: "v2024.01.17" | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     ] | 
					
						
							| 
									
										
										
										
											2025-02-03 23:21:27 +01:00
										 |  |  |                 }, | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2025-02-02 23:00:22 +01:00
										 |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-rpm", | 
					
						
							|  |  |  |             config: { | 
					
						
							| 
									
										
										
										
											2025-04-27 12:13:36 +03:00
										 |  |  |                 options: baseLinuxMakerConfigOptions | 
					
						
							| 
									
										
										
										
											2025-02-02 23:00:22 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-squirrel", | 
					
						
							|  |  |  |             config: { | 
					
						
							| 
									
										
										
										
											2025-04-19 11:38:57 +03:00
										 |  |  |                 name: EXECUTABLE_NAME, | 
					
						
							|  |  |  |                 productName: PRODUCT_NAME, | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |                 iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | 
					
						
							| 
									
										
										
										
											2025-04-26 01:09:28 +03:00
										 |  |  |                 setupIcon: path.join(ELECTRON_FORGE_DIR, "setup-icon/setup.ico"), | 
					
						
							|  |  |  |                 loadingGif: path.join(ELECTRON_FORGE_DIR, "setup-icon/setup-banner.gif"), | 
					
						
							| 
									
										
										
										
											2025-03-24 17:04:22 +02:00
										 |  |  |                 windowsSign: windowsSignConfiguration | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-dmg", | 
					
						
							|  |  |  |             config: { | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  |                 icon: path.join(APP_ICON_PATH, "icon.icns") | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/maker-zip", | 
					
						
							|  |  |  |             config: { | 
					
						
							|  |  |  |                 options: { | 
					
						
							|  |  |  |                     iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | 
					
						
							| 
									
										
										
										
											2025-04-26 09:56:23 +03:00
										 |  |  |                     icon: path.join(APP_ICON_PATH, "icon.ico") | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     ], | 
					
						
							|  |  |  |     plugins: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             name: "@electron-forge/plugin-auto-unpack-natives", | 
					
						
							|  |  |  |             config: {} | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-03-23 23:06:41 +02:00
										 |  |  |     ], | 
					
						
							|  |  |  |     hooks: { | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  |         // Remove unused locales from the packaged app to save some space.
 | 
					
						
							|  |  |  |         postPackage(_, packageResult) { | 
					
						
							| 
									
										
										
										
											2025-06-15 20:49:07 +03:00
										 |  |  |             const isMac = (process.platform === "darwin"); | 
					
						
							|  |  |  |             let localesToKeep = LOCALES | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  |                 .filter(locale => !locale.contentOnly) | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  |                 .map(locale => locale.electronLocale) as string[]; | 
					
						
							| 
									
										
										
										
											2025-06-15 20:49:07 +03:00
										 |  |  |             if (!isMac) { | 
					
						
							| 
									
										
										
										
											2025-06-15 21:27:53 +03:00
										 |  |  |                 localesToKeep = localesToKeep.map(locale => locale.replace("_", "-")) | 
					
						
							| 
									
										
										
										
											2025-06-15 20:49:07 +03:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  |             const keptLocales = new Set(); | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  |             const removedLocales: string[] =  []; | 
					
						
							| 
									
										
										
										
											2025-06-15 20:49:07 +03:00
										 |  |  |             const extension = (isMac ? ".lproj" : ".pak"); | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |             for (const outputPath of packageResult.outputPaths) { | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                 const localeDirs = isMac | 
					
						
							|  |  |  |                     ? [ | 
					
						
							|  |  |  |                         path.join(outputPath, "TriliumNext Notes.app/Contents/Resources"), | 
					
						
							|  |  |  |                         path.join(outputPath, "TriliumNext Notes.app/Contents/Frameworks/Electron Framework.framework/Resources") | 
					
						
							|  |  |  |                     ] | 
					
						
							|  |  |  |                     : [ path.join(outputPath, 'locales') ]; | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                 for (const localeDir of localeDirs) { | 
					
						
							|  |  |  |                     if (!fs.existsSync(localeDir)) { | 
					
						
							|  |  |  |                         console.log(`No locales directory found in '${localeDir}'.`); | 
					
						
							|  |  |  |                         process.exit(2); | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                     const files = fs.readdirSync(localeDir); | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                     for (const file of files) { | 
					
						
							|  |  |  |                         if (!file.endsWith(extension)) { | 
					
						
							|  |  |  |                             continue; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                         let localeName = path.basename(file, extension); | 
					
						
							| 
									
										
										
										
											2025-06-15 21:16:02 +03:00
										 |  |  |                         if (localeName === "en-US" && !isMac) { | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                             // If the locale is "en-US" on Windows, we treat it as "en".
 | 
					
						
							|  |  |  |                             // This is because the Windows version of Electron uses "en-US.pak" instead of "en.pak".
 | 
					
						
							|  |  |  |                             localeName = "en"; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                         if (localesToKeep.includes(localeName)) { | 
					
						
							|  |  |  |                             keptLocales.add(localeName); | 
					
						
							|  |  |  |                             continue; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                         const filePath = path.join(localeDir, file); | 
					
						
							|  |  |  |                         if (isMac) { | 
					
						
							|  |  |  |                             fs.rm(filePath, { recursive: true }); | 
					
						
							|  |  |  |                         } else { | 
					
						
							|  |  |  |                             fs.unlinkSync(filePath); | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-15 21:06:01 +03:00
										 |  |  |                         removedLocales.push(file); | 
					
						
							| 
									
										
										
										
											2025-06-15 20:49:07 +03:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  |             console.log(`Removed unused locale files: ${removedLocales.join(", ")}`); | 
					
						
							| 
									
										
										
										
											2025-06-15 19:57:48 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |             // Ensure all locales that should be kept are actually present.
 | 
					
						
							|  |  |  |             for (const locale of localesToKeep) { | 
					
						
							|  |  |  |                 if (!keptLocales.has(locale)) { | 
					
						
							|  |  |  |                     console.error(`Locale ${locale} was not found in the packaged app.`); | 
					
						
							|  |  |  |                     process.exit(1); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2025-06-11 21:08:02 +03:00
										 |  |  |         // Gather all the artifacts produced by the makers and copy them to a common upload directory.
 | 
					
						
							| 
									
										
										
										
											2025-03-23 23:06:41 +02:00
										 |  |  |         postMake(_, makeResults) { | 
					
						
							| 
									
										
										
										
											2025-03-23 23:08:02 +02:00
										 |  |  |             const outputDir = path.join(__dirname, "..", "upload"); | 
					
						
							| 
									
										
										
										
											2025-03-30 17:34:45 +03:00
										 |  |  |             fs.mkdirpSync(outputDir); | 
					
						
							| 
									
										
										
										
											2025-03-23 23:06:41 +02:00
										 |  |  |             for (const makeResult of makeResults) { | 
					
						
							|  |  |  |                 for (const artifactPath of makeResult.artifacts) { | 
					
						
							| 
									
										
										
										
											2025-03-24 19:04:38 +02:00
										 |  |  |                     // Ignore certain artifacts.
 | 
					
						
							| 
									
										
										
										
											2025-03-24 19:10:29 +02:00
										 |  |  |                     let fileName = path.basename(artifactPath); | 
					
						
							|  |  |  |                     const extension = path.extname(fileName); | 
					
						
							|  |  |  |                     if (fileName === "RELEASES" || extension === ".nupkg") { | 
					
						
							| 
									
										
										
										
											2025-03-24 19:04:38 +02:00
										 |  |  |                         continue; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-24 19:10:29 +02:00
										 |  |  |                     // Override the extension for the CI.
 | 
					
						
							|  |  |  |                     const { TRILIUM_ARTIFACT_NAME_HINT } = process.env; | 
					
						
							|  |  |  |                     if (TRILIUM_ARTIFACT_NAME_HINT) { | 
					
						
							| 
									
										
										
										
											2025-03-30 16:44:46 +03:00
										 |  |  |                         fileName = TRILIUM_ARTIFACT_NAME_HINT.replaceAll("/", "-") + extension; | 
					
						
							| 
									
										
										
										
											2025-03-24 19:10:29 +02:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-24 19:04:38 +02:00
										 |  |  |                     const outputPath = path.join(outputDir, fileName); | 
					
						
							| 
									
										
										
										
											2025-03-23 23:06:41 +02:00
										 |  |  |                     console.log(`[Artifact] ${artifactPath} -> ${outputPath}`); | 
					
						
							| 
									
										
										
										
											2025-03-30 17:34:45 +03:00
										 |  |  |                     fs.copyFileSync(artifactPath, outputPath); | 
					
						
							| 
									
										
										
										
											2025-03-23 23:06:41 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | function getExtraResourcesForPlatform() { | 
					
						
							| 
									
										
										
										
											2025-06-19 15:38:35 +03:00
										 |  |  |     const resources: string[] = []; | 
					
						
							| 
									
										
										
										
											2025-02-05 09:56:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-26 11:58:35 +03:00
										 |  |  |     const getScriptResources = () => { | 
					
						
							| 
									
										
										
										
											2025-02-05 09:56:08 +01:00
										 |  |  |         const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"]; | 
					
						
							|  |  |  |         const scriptExt = (process.platform === "win32") ? "bat" : "sh"; | 
					
						
							| 
									
										
										
										
											2025-04-27 20:58:15 +03:00
										 |  |  |         return scripts.map(script => `electron-forge/${script}.${scriptExt}`); | 
					
						
							| 
									
										
										
										
											2025-02-05 09:56:08 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     switch (process.platform) { | 
					
						
							|  |  |  |         case "win32": | 
					
						
							| 
									
										
										
										
											2025-04-26 11:58:35 +03:00
										 |  |  |             resources.push(...getScriptResources()) | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |             break; | 
					
						
							|  |  |  |         case "linux": | 
					
						
							| 
									
										
										
										
											2025-04-26 11:58:35 +03:00
										 |  |  |             resources.push(...getScriptResources(), path.join(APP_ICON_PATH, "png/256x256.png")); | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |             break; | 
					
						
							|  |  |  |         default: | 
					
						
							|  |  |  |             break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-09 18:07:02 +02:00
										 |  |  |     return resources; | 
					
						
							|  |  |  | } |