From f0722287bee9e519322069f47c398f67153e4eba Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Wed, 27 Feb 2019 15:05:01 -0800 Subject: [PATCH] Fix Mac ZIP building MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- scripts/build-release.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/build-release.js b/scripts/build-release.js index 13399515b..9db7e9279 100755 --- a/scripts/build-release.js +++ b/scripts/build-release.js @@ -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); }