| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | const path = require('path'); | 
					
						
							|  |  |  | const fs = require('fs-extra'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-11 06:57:34 +03:00
										 |  |  | const APP_NAME = "TriliumNext Notes"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  | module.exports = { | 
					
						
							|  |  |  |   packagerConfig: { | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     executableName: "trilium", | 
					
						
							| 
									
										
										
										
											2024-08-11 06:57:34 +03:00
										 |  |  |     name: APP_NAME, | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     overwrite: true, | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  |     asar: true, | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     icon: "./images/app-icons/icon", | 
					
						
							|  |  |  |     extraResource: getExtraResourcesForPlatform(), | 
					
						
							| 
									
										
										
										
											2024-08-11 06:57:34 +03:00
										 |  |  |     afterComplete: [(buildPath, _electronVersion, platform, _arch, callback) => { | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |       const extraResources = getExtraResourcesForPlatform(); | 
					
						
							|  |  |  |       for (const resource of extraResources) { | 
					
						
							| 
									
										
										
										
											2024-08-09 22:23:54 +02:00
										 |  |  |         let sourcePath; | 
					
						
							|  |  |  |         if (platform === 'darwin') { | 
					
						
							| 
									
										
										
										
											2024-08-11 06:57:34 +03:00
										 |  |  |           sourcePath = path.join(buildPath, `${APP_NAME}.app`, 'Contents', 'Resources', path.basename(resource)); | 
					
						
							| 
									
										
										
										
											2024-08-09 22:23:54 +02:00
										 |  |  |         } else { | 
					
						
							|  |  |  |           sourcePath = path.join(buildPath, 'resources', path.basename(resource)); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |         const destPath = path.join(buildPath, path.basename(resource)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // Copy files from resources folder to root
 | 
					
						
							|  |  |  |         fs.move(sourcePath, destPath) | 
					
						
							|  |  |  |           .then(() => callback()) | 
					
						
							|  |  |  |           .catch(err => callback(err)); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }] | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   rebuildConfig: { | 
					
						
							|  |  |  |     force: true | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  |   }, | 
					
						
							|  |  |  |   makers: [ | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |       name: '@electron-forge/maker-deb', | 
					
						
							|  |  |  |       config: { | 
					
						
							|  |  |  |         options: { | 
					
						
							|  |  |  |           icon: "./images/app-icons/png/128x128.png", | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  |     { | 
					
						
							|  |  |  |       name: '@electron-forge/maker-squirrel', | 
					
						
							| 
									
										
										
										
											2023-11-08 22:10:22 +02:00
										 |  |  |       config: { | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |         iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | 
					
						
							|  |  |  |         setupIcon: "./images/app-icons/icon.ico", | 
					
						
							| 
									
										
										
										
											2023-11-08 23:08:38 +02:00
										 |  |  |         loadingGif: "./images/app-icons/win/setup-banner.gif" | 
					
						
							| 
									
										
										
										
											2023-11-08 23:53:08 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       name: '@electron-forge/maker-dmg', | 
					
						
							|  |  |  |       config: { | 
					
						
							| 
									
										
										
										
											2024-08-05 20:20:35 +02:00
										 |  |  |         icon: "./images/app-icons/icon.icns", | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       name: '@electron-forge/maker-zip', | 
					
						
							|  |  |  |       config: { | 
					
						
							|  |  |  |         options: { | 
					
						
							|  |  |  |           iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico", | 
					
						
							| 
									
										
										
										
											2024-08-05 20:20:35 +02:00
										 |  |  |           icon: "./images/app-icons/icon.ico", | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2023-11-09 20:04:07 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-08 21:27:48 +02:00
										 |  |  |   ], | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       name: '@electron-forge/plugin-auto-unpack-natives', | 
					
						
							|  |  |  |       config: {}, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   ], | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function getExtraResourcesForPlatform() { | 
					
						
							| 
									
										
										
										
											2024-10-12 19:40:54 +03:00
										 |  |  |   let resources = [ | 
					
						
							|  |  |  |     'dump-db/', | 
					
						
							|  |  |  |     './bin/tpl/anonymize-database.sql', | 
					
						
							|  |  |  |     'translations/' | 
					
						
							|  |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2024-08-05 18:47:57 +02:00
										 |  |  |   const scripts = ['trilium-portable', 'trilium-safe-mode', 'trilium-no-cert-check'] | 
					
						
							|  |  |  |   switch (process.platform) { | 
					
						
							|  |  |  |     case 'win32': | 
					
						
							|  |  |  |       for (const script of scripts) { | 
					
						
							|  |  |  |         resources.push(`./bin/tpl/${script}.bat`) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case 'darwin': | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case 'linux': | 
					
						
							|  |  |  |       for (const script of scripts) { | 
					
						
							|  |  |  |         resources.push(`./bin/tpl/${script}.sh`) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return resources; | 
					
						
							|  |  |  | } |