1
+ const path = require ( 'path' ) ;
2
+ const fs = require ( 'fs-extra' ) ;
3
+
1
4
module . exports = {
2
5
packagerConfig : {
6
+ executableName : "trilium" ,
7
+ name : 'trilium' ,
8
+ overwrite : true ,
3
9
asar : true ,
4
10
// 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
6
29
} ,
7
- rebuildConfig : { } ,
8
30
makers : [
31
+ {
32
+ name : '@electron-forge/maker-deb' ,
33
+ config : {
34
+ options : {
35
+ icon : "./images/app-icons/png/128x128.png" ,
36
+ }
37
+ }
38
+ } ,
9
39
{
10
40
name : '@electron-forge/maker-squirrel' ,
11
41
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" ,
14
44
loadingGif : "./images/app-icons/win/setup-banner.gif"
15
45
}
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
+ }
16
63
}
17
64
] ,
18
65
plugins : [
@@ -22,3 +69,27 @@ module.exports = {
22
69
} ,
23
70
] ,
24
71
} ;
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