forked from minbrowser/min
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildMac.js
43 lines (34 loc) · 1.11 KB
/
buildMac.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
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
const archiver = require('archiver')
const builder = require('electron-builder')
const Arch = builder.Arch
const packageFile = require('./../package.json')
const version = packageFile.version
const platform = process.argv.find(arg => arg.match('platform')).split('=')[1]
function toArch (platform) {
switch (platform) {
case 'x86':
return Arch.x64
case 'arm64':
return Arch.arm64
}
}
require('./createPackage.js')('mac', { arch: toArch(platform) }).then(function (packagePath) {
if (platform === 'arm64') {
execSync('codesign -s - -a arm64 -f --deep ' + packagePath + '/Min.app')
}
/* create output directory if it doesn't exist */
if (!fs.existsSync('dist/app')) {
fs.mkdirSync('dist/app')
}
/* create zip file */
var output = fs.createWriteStream('dist/app/min-v' + version + '-mac-' + platform + '.zip')
var archive = archiver('zip', {
zlib: { level: 9 }
})
archive.directory(path.resolve(packagePath, 'Min.app'), 'Min.app')
archive.pipe(output)
archive.finalize()
})