forked from webcatalog/webcatalog-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist.js
executable file
·57 lines (49 loc) · 1.36 KB
/
dist.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
/* eslint-disable no-console */
const fs = require('fs-extra');
const builder = require('electron-builder');
const { Platform } = builder;
console.log(`Machine: ${process.platform}`);
const PACKAGE_JSON_PATH = 'package.json';
const TEMPLATE_PACKAGE_JSON_PATH = 'template/package.json';
const TEMPLATE_JSON_PATH = 'dist/template.json';
const packageJson = fs.readJSONSync(PACKAGE_JSON_PATH);
const templatePackageJson = fs.readJSONSync(TEMPLATE_PACKAGE_JSON_PATH);
if (packageJson.templateVersion !== templatePackageJson.version) {
console.log('templateVersion is not correctly updated.');
process.exit(1);
}
fs.ensureFileSync(TEMPLATE_JSON_PATH);
fs.writeJSONSync(TEMPLATE_JSON_PATH, {
version: templatePackageJson.version,
});
const opts = {
targets: Platform.MAC.createTarget(),
config: {
appId: 'com.webcatalog.jordan',
productName: 'WebCatalog',
asar: false,
files: [
'default-icon.png',
'template.tar.gz',
'!tests/**/*',
'!docs/**/*',
'!catalog/**/*',
'!template/**/*',
],
directories: {
buildResources: 'build-resources',
},
mac: {
category: 'public.app-category.utilities',
},
afterAllArtifactBuild: () => [TEMPLATE_JSON_PATH],
},
};
builder.build(opts)
.then(() => {
console.log('build successful');
})
.catch((err) => {
console.log(err);
process.exit(1);
});