forked from Automattic/simplenote-electron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.js
67 lines (62 loc) · 1.57 KB
/
builder.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
/* eslint-disable no-console */
/**
* External Dependencies
*/
var packager = require('electron-packager');
var fs = require('fs');
var path = require('path');
/**
* Internal dependencies
*/
var config = require('./resources/lib/config');
var builder = require('./resources/lib/tools');
var pkg = require('./package.json');
/**
* Module variables
*/
var electronVersion = pkg.devDependencies['electron'].replace('^', '');
var key;
var opts = {
dir: './desktop-build',
name: config.name,
author: config.author,
platform: builder.getPlatform(process.argv),
arch: builder.getArch(process.argv),
electronVersion,
appVersion: config.version,
appSign: 'Developer ID Application: ' + config.author,
out: './release',
icon: builder.getIconFile(process.argv),
appBundleId: config.bundleId,
helperBundleId: config.bundleId,
appCategoryType: 'public.app-category.social-networking',
buildVersion: config.version,
overwrite: true,
asar: false,
sign: false,
prune: true,
ignore: [],
'version-string': {
CompanyName: config.author,
LegalCopyright: config.copyright,
ProductName: config.name,
InternalName: config.name,
FileDescription: config.name,
OriginalFilename: config.name,
FileVersion: config.version,
ProductVersion: config.version,
},
};
builder.beforeBuild(__dirname, opts, function(error) {
if (error) {
throw error;
}
packager(opts, function(err) {
if (err) {
console.log('Packager Error:');
console.log(err);
} else {
builder.cleanUp(path.join(__dirname, 'release'), opts);
}
});
});