1+ const path = require ( 'path' ) ;
2+ const fs = require ( 'fs-extra' ) ;
3+
14module . exports = {
25 packagerConfig : {
6+ executableName : "trilium" ,
7+ name : 'trilium' ,
8+ overwrite : true ,
39 asar : true ,
410 // icon will break once we add .dmg support, since the .ico & .icns have to be in same dir (see https://www.electronforge.io/guides/create-and-add-icons#windows-and-macos)
5- icon : "./images/app-icons/win/icon"
11+ icon : "./images/app-icons/icon" ,
12+ extraResource : getExtraResourcesForPlatform ( ) ,
13+ files : [ { from : './bin/tpl/anonymize-database.tql' , to : '.' } ] ,
14+ afterComplete : [ ( buildPath , electronVersion , platform , arch , callback ) => {
15+ const extraResources = getExtraResourcesForPlatform ( ) ;
16+ for ( const resource of extraResources ) {
17+ const sourcePath = path . join ( buildPath , 'resources' , path . basename ( resource ) ) ;
18+ const destPath = path . join ( buildPath , path . basename ( resource ) ) ;
19+
20+ // Copy files from resources folder to root
21+ fs . move ( sourcePath , destPath )
22+ . then ( ( ) => callback ( ) )
23+ . catch ( err => callback ( err ) ) ;
24+ }
25+ } ]
26+ } ,
27+ rebuildConfig : {
28+ force : true
629 } ,
7- rebuildConfig : { } ,
830 makers : [
31+ {
32+ name : '@electron-forge/maker-deb' ,
33+ config : {
34+ options : {
35+ icon : "./images/app-icons/png/128x128.png" ,
36+ }
37+ }
38+ } ,
939 {
1040 name : '@electron-forge/maker-squirrel' ,
1141 config : {
12- iconUrl : "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/win/ icon.ico" ,
13- setupIcon : "./images/app-icons/win/ icon.ico" ,
42+ iconUrl : "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico" ,
43+ setupIcon : "./images/app-icons/icon.ico" ,
1444 loadingGif : "./images/app-icons/win/setup-banner.gif"
1545 }
46+ } ,
47+ {
48+ name : '@electron-forge/maker-dmg' ,
49+ arch : [ 'x64' , 'arm64' ] ,
50+ config : {
51+ icon : "./images/app-icons/mac/icon.icns" ,
52+ }
53+ } ,
54+ {
55+ name : '@electron-forge/maker-zip' ,
56+ config : {
57+ options : {
58+ iconUrl : "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico" ,
59+ setupIcon : "./images/app-icons/icon.ico" ,
60+ loadingGif : "./images/app-icons/win/setup-banner.gif"
61+ }
62+ }
1663 }
1764 ] ,
1865 plugins : [
@@ -22,3 +69,27 @@ module.exports = {
2269 } ,
2370 ] ,
2471} ;
72+
73+
74+ function getExtraResourcesForPlatform ( ) {
75+ let resources = [ 'dump-db/' , './bin/tpl/anonymize-database.sql' ]
76+ const scripts = [ 'trilium-portable' , 'trilium-safe-mode' , 'trilium-no-cert-check' ]
77+ switch ( process . platform ) {
78+ case 'win32' :
79+ for ( const script of scripts ) {
80+ resources . push ( `./bin/tpl/${ script } .bat` )
81+ }
82+ break ;
83+ case 'darwin' :
84+ break ;
85+ case 'linux' :
86+ for ( const script of scripts ) {
87+ resources . push ( `./bin/tpl/${ script } .sh` )
88+ }
89+ break ;
90+ default :
91+ break ;
92+ }
93+
94+ return resources ;
95+ }
0 commit comments