forked from minbrowser/min
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreatePackage.js
68 lines (62 loc) · 1.62 KB
/
createPackage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const packager = require('electron-packager')
const packageFile = require('./../package.json')
const version = packageFile.version
const electronVersion = packageFile.electronVersion
const basedir = require('path').join(__dirname, '../')
// directories that will be ignored when building binaries
const ignoredDirs = [
'.DS_Store',
'dist/app',
/\.map$/g,
/\.md$/g,
// electron-installer-debian is actually a development module, but it isn't pruned because it's optional
'node_modules/electron-installer-debian',
'node_modules/electron-installer-common',
// this is copied during the build
'icon.icns',
// localization files are compiled and copied to dist
'localization/'
]
var baseOptions = {
name: 'Min',
dir: basedir,
out: 'dist/app',
electronVersion: electronVersion,
appVersion: version,
arch: 'all',
ignore: ignoredDirs,
prune: true,
overwrite: true
}
var platformOptions = {
darwin: {
platform: 'darwin',
icon: 'icon.icns',
darwinDarkModeSupport: true,
protocols: [{
name: 'HTTP link',
schemes: ['http', 'https']
}, {
name: 'File',
schemes: ['file']
}]
},
win32: {
platform: 'win32',
icon: 'icons/icon256.ico'
},
linux: {
name: 'min', // name must be lowercase to run correctly after installation
platform: 'linux',
arch: 'x64'
},
raspbian: {
name: 'min', // name must be lowercase to run correctly after installation
platform: 'linux',
arch: 'armv7l',
fpm: ['--architecture', 'armhf']
}
}
module.exports = function (platform) {
return packager(Object.assign({}, baseOptions, platformOptions[platform]))
}