Skip to content
Permalink
Browse files

feat(installer): add DMG support for macOS installer

  • Loading branch information
MarshallOfSound committed Dec 28, 2016
1 parent 5cbf8cb commit 3465d2614a6394a7bc10e9f4235c6b0a835f7cce
Showing with 17 additions and 1 deletion.
  1. +3 −1 src/electron-forge-install.js
  2. +14 −0 src/installers/darwin/dmg.js
@@ -14,6 +14,7 @@ import semver from 'semver';

import './util/terminate';

import darwinDMGInstaller from './installers/darwin/dmg';
import darwinZipInstaller from './installers/darwin/zip';

const d = debug('electron-forge:lint');
@@ -72,7 +73,7 @@ const main = async () => {

const installTargets = {
win32: ['.exe'],
darwin: ['OSX.zip', 'darwin.zip', 'macOS.zip', 'mac.zip'],
darwin: ['OSX.zip', 'darwin.zip', 'macOS.zip', 'mac.zip', '.dmg'],
linux: ['.rpm', '.deb', '.flatpak'],
};

@@ -130,6 +131,7 @@ const main = async () => {
},
darwin: {
'.zip': darwinZipInstaller,
'.dmg': darwinDMGInstaller,
},
linux: {
'.deb': async () => {},
@@ -0,0 +1,14 @@
import fs from 'fs-promise';
import opn from 'opn';
import path from 'path';
import pify from 'pify';
import { exec } from 'child_process';

export default async (filePath) => {
const DMGPath = path.join(path.dirname(filePath), path.parse(filePath).name);
if (await fs.exists(DMGPath)) {
await fs.remove(DMGPath);
}
await pify(exec)(`cp "${filePath}" "${DMGPath}"`);
await opn(DMGPath, { wait: false });
};

0 comments on commit 3465d26

Please sign in to comment.
You can’t perform that action at this time.