-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathelectronPackager.js
47 lines (40 loc) · 1.13 KB
/
electronPackager.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
const fs = require('fs');
const packager = require('electron-packager');
const appVersion = require('./package.json').version;
const execSync = require('child_process').execSync;
const commitHash = execSync('git rev-parse HEAD').toString().trim();
process.env.COMMIT_HASH = commitHash;
const options = {
dir: '.',
out: 'app-build',
name: 'HTML to Sketch',
icon: 'resources/icon.icns',
platform: 'darwin',
arch: 'x64',
asar: false,
overwrite: true,
prune: false,
appVersion: appVersion,
ignore: [
'.gitignore',
'electronPackager.js',
'downloadLink.json',
'gulpfile.js',
'package-lock.json',
'yarn.lock',
'README.md',
'node_modules/gulp',
'node_modules/electron$',
/.*\.gif/,
/.*\.zip/,
]
};
fs.writeFileSync('commitHash.json', JSON.stringify({commitHash}, null, 2));
packager(options)
.then((appPaths) => {
fs.unlinkSync('commitHash.json');
console.log('Done app packaging.');
const command = `ditto -c -k --sequesterRsrc --keepParent "${appPaths}/HTML to Sketch.app" "HTML-to-Sketch-app.zip"`;
console.log('Archiving app to zip...');
execSync(command);
});