Skip to content

Commit

Permalink
fix(maker-dmg): return correct path from dmg maker
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #626
  • Loading branch information
MarshallOfSound authored and malept committed Nov 17, 2018
1 parent 01e715f commit 6c8b70c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/maker/dmg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"dependencies": {
"@electron-forge/maker-base": "6.0.0-beta.29",
"@electron-forge/shared-types": "6.0.0-beta.29",
"fs-extra": "^7.0.0",
"pify": "^4.0.0"
"fs-extra": "^7.0.0"
},
"optionalDependencies": {
"electron-installer-dmg": "^2.0.0"
Expand Down
13 changes: 8 additions & 5 deletions packages/maker/dmg/src/MakerDMG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { MakerDMGConfig } from './Config';

import fs from 'fs-extra';
import path from 'path';
import pify from 'pify';

export default class MakerDMG extends MakerBase<MakerDMGConfig> {
name = 'dmg';
Expand All @@ -24,7 +23,8 @@ export default class MakerDMG extends MakerBase<MakerDMGConfig> {
const electronDMG = require('electron-installer-dmg');

const outPath = path.resolve(makeDir, `${this.config.name || appName}.dmg`);
const wantedOutPath = path.resolve(makeDir, `${appName}-${packageJSON.version}.dmg`);
const forgeDefaultOutPath = path.resolve(makeDir, `${appName}-${packageJSON.version}.dmg`);

await this.ensureFile(outPath);
const dmgConfig = Object.assign({
overwrite: true,
Expand All @@ -33,10 +33,13 @@ export default class MakerDMG extends MakerBase<MakerDMGConfig> {
appPath: path.resolve(dir, `${appName}.app`),
out: path.dirname(outPath),
});
await pify(electronDMG)(dmgConfig);
const opts = await electronDMG.p(dmgConfig);
if (!this.config.name) {
await fs.rename(outPath, wantedOutPath);
await this.ensureFile(forgeDefaultOutPath);
await fs.rename(outPath, forgeDefaultOutPath);
return [forgeDefaultOutPath];
}
return [wantedOutPath];

return [opts.dmgPath];
}
}

0 comments on commit 6c8b70c

Please sign in to comment.