From f61c44cfc89688455786ec66ed5109aea7ba1ca3 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 8 Aug 2021 20:02:44 -0700 Subject: [PATCH] fix(maker-dmg): add the arch to the default dmg name --- packages/maker/dmg/package.json | 4 ++++ packages/maker/dmg/src/MakerDMG.ts | 3 ++- packages/maker/dmg/test/MakerDMG_spec.ts | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/maker/dmg/package.json b/packages/maker/dmg/package.json index 3b098b07b4..3ba47003c0 100644 --- a/packages/maker/dmg/package.json +++ b/packages/maker/dmg/package.json @@ -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", diff --git a/packages/maker/dmg/src/MakerDMG.ts b/packages/maker/dmg/src/MakerDMG.ts index 8b75e9eef0..eeb19131c3 100644 --- a/packages/maker/dmg/src/MakerDMG.ts +++ b/packages/maker/dmg/src/MakerDMG.ts @@ -19,12 +19,13 @@ export default class MakerDMG extends MakerBase { 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 = { diff --git a/packages/maker/dmg/test/MakerDMG_spec.ts b/packages/maker/dmg/test/MakerDMG_spec.ts index 1d68a3b021..3885481e23 100644 --- a/packages/maker/dmg/test/MakerDMG_spec.ts +++ b/packages/maker/dmg/test/MakerDMG_spec.ts @@ -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 () => {