Add DMG target to mac distribution (#833)

Summary:
Fixes https://github.com/facebook/flipper/issues/807 by adding a DMG target to distribute the application for mac.

The `.dmg` file is `97.2 MB` while the `.zip` is `101.5 MB`. 😄

![image](https://user-images.githubusercontent.com/6207220/75275890-7c32b480-5805-11ea-9d05-9a4f47d03562.png)

## Changelog

Add DMG target for mac distribution
Pull Request resolved: https://github.com/facebook/flipper/pull/833

Test Plan:
1. `yarn build --mac`;
1. Check `flipper-mac.dmg` inside of `dist`.

 ---

**The background is completely discussable, I borrowed it [from an old project](https://github.com/lucasbento/react-native-actions/tree/feature/electron/packages/electron-react-native-actions) of mine and it's [totally not inspired by WebStorm `.dmg` file](https://user-images.githubusercontent.com/6207220/75276024-b3a16100-5805-11ea-8c69-063fe28316c1.png).**

Reviewed By: nikoant

Differential Revision: D20139188

Pulled By: passy

fbshipit-source-id: 1aaaabd7c6ac51d12865388bf962d164f80a7a14
This commit is contained in:
Lucas Bento
2020-02-27 09:30:17 -08:00
committed by Facebook Github Bot
parent ab0078a13f
commit be360157f6
3 changed files with 22 additions and 1 deletions

View File

@@ -25,6 +25,27 @@
"NSUserNotificationAlertStyle": "alert" "NSUserNotificationAlertStyle": "alert"
} }
}, },
"dmg": {
"background": "dmgBackground.png",
"icon": "icon.icns",
"iconSize": 155,
"window": {
"width": 660,
"height": 400
},
"contents": [
{
"x": 123,
"y": 172
},
{
"x": 539,
"y": 168,
"type": "link",
"path": "/Applications"
}
]
},
"win": { "win": {
"publisherName": "Facebook, Inc.", "publisherName": "Facebook, Inc.",
"sign": null "sign": null

View File

@@ -67,7 +67,7 @@ async function buildDist(buildFolder: string) {
const postBuildCallbacks: (() => void)[] = []; const postBuildCallbacks: (() => void)[] = [];
if (process.argv.indexOf('--mac') > -1) { if (process.argv.indexOf('--mac') > -1) {
targetsRaw.push(Platform.MAC.createTarget(['dir'])); targetsRaw.push(Platform.MAC.createTarget(['dir', 'dmg']));
postBuildCallbacks.push(() => postBuildCallbacks.push(() =>
spawn('zip', ['-qyr9', '../Flipper-mac.zip', 'Flipper.app'], { spawn('zip', ['-qyr9', '../Flipper-mac.zip', 'Flipper.app'], {
cwd: path.join(__dirname, '..', 'dist', 'mac'), cwd: path.join(__dirname, '..', 'dist', 'mac'),

BIN
static/dmgBackground.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB