From e6841e7860b2aa510e502f87bc899219a16693a0 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 1 Oct 2024 23:59:28 +0100 Subject: [PATCH 1/2] feat(makerDeb): Add rename function --- packages/maker/deb/src/MakerDeb.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/maker/deb/src/MakerDeb.ts b/packages/maker/deb/src/MakerDeb.ts index e1d38e010e..04c8daf443 100644 --- a/packages/maker/deb/src/MakerDeb.ts +++ b/packages/maker/deb/src/MakerDeb.ts @@ -5,6 +5,10 @@ import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types'; import { MakerDebConfig } from './Config'; +function renameDeb(dest: string, _src: string): string { + return path.join(dest, '<%= name %>-<%= version %>-<%= revision %>.<%= arch === "aarch64" ? "arm64" : arch %>.deb'); +} + export function debianArch(nodeArch: ForgeArch): string { switch (nodeArch) { case 'ia32': @@ -44,7 +48,7 @@ export default class MakerDeb extends MakerBase { arch: debianArch(targetArch), src: dir, dest: outDir, - rename: undefined, + rename: renameDeb, }); return packagePaths; From b8080052eb92ab870990a8665e16242001874e65 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 2 Oct 2024 02:01:40 +0100 Subject: [PATCH 2/2] refactor: Move to lambda function for rename fix: Apply the executable name correctly over using package name --- packages/maker/deb/src/Config.ts | 1 + packages/maker/deb/src/MakerDeb.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/maker/deb/src/Config.ts b/packages/maker/deb/src/Config.ts index f13adca1a8..0b9faa719c 100644 --- a/packages/maker/deb/src/Config.ts +++ b/packages/maker/deb/src/Config.ts @@ -209,5 +209,6 @@ export interface MakerDebConfigOptions { } export interface MakerDebConfig { + name?: string; options?: MakerDebConfigOptions; } diff --git a/packages/maker/deb/src/MakerDeb.ts b/packages/maker/deb/src/MakerDeb.ts index 04c8daf443..beb6287b44 100644 --- a/packages/maker/deb/src/MakerDeb.ts +++ b/packages/maker/deb/src/MakerDeb.ts @@ -5,10 +5,6 @@ import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types'; import { MakerDebConfig } from './Config'; -function renameDeb(dest: string, _src: string): string { - return path.join(dest, '<%= name %>-<%= version %>-<%= revision %>.<%= arch === "aarch64" ? "arm64" : arch %>.deb'); -} - export function debianArch(nodeArch: ForgeArch): string { switch (nodeArch) { case 'ia32': @@ -35,20 +31,23 @@ export default class MakerDeb extends MakerBase { return this.isInstalled('electron-installer-debian'); } - async make({ dir, makeDir, targetArch }: MakerOptions): Promise { + async make({ dir, makeDir, appName, packageJSON, targetArch, forgeConfig }: MakerOptions): Promise { // eslint-disable-next-line node/no-missing-require const installer = require('electron-installer-debian'); const outDir = path.resolve(makeDir, 'deb', targetArch); + const name = this.config.name || `${appName}_${packageJSON.version}_${debianArch(targetArch)}`; await this.ensureDirectory(outDir); const { packagePaths } = await installer({ - options: {}, ...this.config, + bin: forgeConfig.packagerConfig.executableName || appName, arch: debianArch(targetArch), src: dir, dest: outDir, - rename: renameDeb, + rename: (dest: string) => { + return path.join(dest, `${name}.deb`); + }, }); return packagePaths;