Skip to content

Commit

Permalink
fix(maker-dmg): add the arch to the default dmg name
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Aug 9, 2021
1 parent 4a992b7 commit f61c44c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/maker/dmg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"license": "MIT",
"main": "dist/MakerDMG.js",
"typings": "dist/MakerDMG.d.ts",
"scripts": {
"test": "yarn test:base test/**/*_spec.ts",
"test:base": "cross-env TS_NODE_FILES=1 mocha --config ../../../.mocharc.js"
},
"devDependencies": {
"chai": "^4.3.3",
"chai-as-promised": "^7.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/maker/dmg/src/MakerDMG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export default class MakerDMG extends MakerBase<MakerDMGConfig> {
makeDir,
appName,
packageJSON,
targetArch,
}: MakerOptions) {
// eslint-disable-next-line global-require
const electronDMG = require('electron-installer-dmg');

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

await this.ensureFile(outPath);
const dmgConfig = {
Expand Down
4 changes: 2 additions & 2 deletions packages/maker/dmg/test/MakerDMG_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ describe('MakerDMG', () => {
dir, makeDir, appName, targetArch, packageJSON,
});
expect(renameStub.callCount).to.equal(1);
expect(renameStub.firstCall.args[1]).to.include('1.2.3');
expect(renameStub.firstCall.args[1]).to.include(`1.2.3-${targetArch}`);
});

it('should rename the DMG file to include the version if no custom name is set', async () => {
await (maker.make as any)({
dir, makeDir, appName, targetArch, packageJSON,
});
expect(renameStub.firstCall.args[1]).to.include('1.2.3');
expect(renameStub.firstCall.args[1]).to.include(`1.2.3-${targetArch}`);
});

it('should not attempt to rename the DMG file if a custom name is set', async () => {
Expand Down

0 comments on commit f61c44c

Please sign in to comment.