Fix Mac ZIP building
Summary: The current Mac zip creation in electron-builder is broken and creates corrupt zip builder. Other platforms are still fine. This just zips stuff up manually and ensures that symlinks are preserved. Thanks a lot to Daniel Büchele for helping me wrap my head around untyped promises. Reviewed By: jknoxville Differential Revision: D14243002 fbshipit-source-id: 908d176275e5d22173e587c0eb4d7c4b2b7c2e0f
This commit is contained in:
committed by
Facebook Github Bot
parent
56576a84ce
commit
f0722287be
@@ -7,6 +7,7 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const builder = require('electron-builder');
|
||||
const cp = require('child-process-es6-promise');
|
||||
const Platform = builder.Platform;
|
||||
const {
|
||||
buildFolder,
|
||||
@@ -50,9 +51,15 @@ function modifyPackageManifest(buildFolder, versionNumber) {
|
||||
|
||||
function buildDist(buildFolder) {
|
||||
const targetsRaw = [];
|
||||
const postBuildCallbacks = [];
|
||||
|
||||
if (process.argv.indexOf('--mac') > -1) {
|
||||
targetsRaw.push(Platform.MAC.createTarget(['zip']));
|
||||
targetsRaw.push(Platform.MAC.createTarget(['dir']));
|
||||
postBuildCallbacks.push(() =>
|
||||
cp.spawn('zip', ['-yr9', '../Flipper-mac.zip', 'Flipper.app'], {
|
||||
cwd: path.join(__dirname, '..', 'dist', 'mac'),
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (process.argv.indexOf('--linux') > -1) {
|
||||
targetsRaw.push(Platform.LINUX.createTarget(['zip']));
|
||||
@@ -91,6 +98,7 @@ function buildDist(buildFolder) {
|
||||
projectDir: buildFolder,
|
||||
targets,
|
||||
})
|
||||
.then(() => Promise.all(postBuildCallbacks.map(p => p())))
|
||||
.catch(die);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user