diff --git a/packages/api/core/src/api/make.ts b/packages/api/core/src/api/make.ts index 09226e576a..b19ffd5f10 100644 --- a/packages/api/core/src/api/make.ts +++ b/packages/api/core/src/api/make.ts @@ -115,10 +115,10 @@ export default async ({ if ((target as MakerBase).__isElectronForgeMaker) { maker = target as MakerBase; /* eslint-enable @typescript-eslint/no-explicit-any */ - // eslint-disable-next-line no-continue if (!maker.platforms.includes(actualTargetPlatform)) continue; } else { const resolvableTarget: IForgeResolvableMaker = target as IForgeResolvableMaker; + if (resolvableTarget.disabled) continue; if (!resolvableTarget.name) { throw new Error(`The following maker config is missing a maker name: ${JSON.stringify(resolvableTarget)}`); diff --git a/packages/api/core/test/fast/make_spec.ts b/packages/api/core/test/fast/make_spec.ts index 275f9c573b..e1b21e8952 100644 --- a/packages/api/core/test/fast/make_spec.ts +++ b/packages/api/core/test/fast/make_spec.ts @@ -60,4 +60,20 @@ describe('make', () => { ).to.eventually.be.rejectedWith(/^The following maker config has a maker name that is not a string:/); }); }); + + it('can skip makers via config', async () => { + const stubbedMake = proxyquire.noCallThru().load('../../src/api/make', { + '../util/read-package-json': { + readMutatedPackageJson: () => Promise.resolve(require('../fixture/app-with-maker-disable/package.json')), + }, + }).default; + await expect( + stubbedMake({ + arch: 'x64', + platform: 'linux', + skipPackage: true, + }) + ).to.eventually.be.rejectedWith(/Could not find any make targets configured for the "linux" platform./); + proxyquire.callThru(); + }); }); diff --git a/packages/api/core/test/fixture/app-with-maker-disable/out/test-linux-x64/.gitkeep b/packages/api/core/test/fixture/app-with-maker-disable/out/test-linux-x64/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/api/core/test/fixture/app-with-maker-disable/package.json b/packages/api/core/test/fixture/app-with-maker-disable/package.json new file mode 100644 index 0000000000..1604ce8923 --- /dev/null +++ b/packages/api/core/test/fixture/app-with-maker-disable/package.json @@ -0,0 +1,19 @@ +{ + "name": "test", + "config": { + "forge": { + "makers": [ + { + "name": "@electron-forge/maker-zip", + "skip": true, + "platforms": [ + "linux" + ] + } + ] + } + }, + "devDependencies": { + "electron": "^1000.0.0" + } +} diff --git a/packages/utils/types/src/index.ts b/packages/utils/types/src/index.ts index bd09d460a1..4e98caa879 100644 --- a/packages/utils/types/src/index.ts +++ b/packages/utils/types/src/index.ts @@ -70,6 +70,7 @@ export interface IForgePlugin { } export interface IForgeResolvableMaker { + disabled: boolean; name: string; platforms: ForgePlatform[] | null; config: any; // eslint-disable-line @typescript-eslint/no-explicit-any