From 493368c9e9d75bdd722303b222377cbb279173a4 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 26 Oct 2022 12:06:05 -0700 Subject: [PATCH] refactor: add / use named exports for plugins + makers + publishers (#2996) --- packages/api/core/src/api/make.ts | 2 +- packages/api/core/test/fixture/custom-maker.ts | 2 +- packages/maker/appx/src/MakerAppX.ts | 4 ++-- packages/maker/base/src/Maker.ts | 2 ++ packages/maker/base/test/ensure-output_spec.ts | 2 +- packages/maker/base/test/support_spec.ts | 2 +- packages/maker/base/test/version_spec.ts | 2 +- packages/maker/deb/src/MakerDeb.ts | 4 ++-- packages/maker/deb/test/MakerDeb_spec.ts | 2 +- packages/maker/dmg/src/MakerDMG.ts | 4 ++-- packages/maker/dmg/test/MakerDMG_spec.ts | 2 +- packages/maker/flatpak/src/MakerFlatpak.ts | 4 ++-- packages/maker/flatpak/test/MakerFlatpak_spec.ts | 2 +- packages/maker/pkg/src/MakerPKG.ts | 4 ++-- packages/maker/pkg/test/MakerPKG_spec.ts | 2 +- packages/maker/rpm/src/MakerRpm.ts | 4 ++-- packages/maker/rpm/test/MakerRpm_spec.ts | 2 +- packages/maker/snap/src/MakerSnap.ts | 4 ++-- packages/maker/snap/test/MakerSnap_spec.ts | 2 +- packages/maker/squirrel/src/MakerSquirrel.ts | 4 +++- packages/maker/wix/src/MakerWix.ts | 4 ++-- packages/maker/zip/src/MakerZIP.ts | 4 +++- .../auto-unpack-natives/src/AutoUnpackNativesPlugin.ts | 4 ++-- packages/plugin/base/src/Plugin.ts | 2 ++ packages/plugin/compile/src/CompilePlugin.ts | 6 +++--- .../plugin/electronegativity/src/ElectronegativityPlugin.ts | 4 +++- packages/plugin/local-electron/src/LocalElectronPlugin.ts | 4 ++-- packages/plugin/webpack/src/WebpackPlugin.ts | 4 ++-- packages/publisher/base/src/Publisher.ts | 2 ++ packages/publisher/bitbucket/src/PublisherBitbucket.ts | 4 ++-- .../publisher/electron-release-server/src/PublisherERS.ts | 4 ++-- packages/publisher/github/src/PublisherGithub.ts | 4 ++-- packages/publisher/nucleus/src/PublisherNucleus.ts | 4 ++-- packages/publisher/s3/src/PublisherS3.ts | 4 ++-- packages/publisher/snapcraft/src/PublisherSnapcraft.ts | 4 ++-- 35 files changed, 63 insertions(+), 51 deletions(-) diff --git a/packages/api/core/src/api/make.ts b/packages/api/core/src/api/make.ts index 575f4879b5..5e47110103 100644 --- a/packages/api/core/src/api/make.ts +++ b/packages/api/core/src/api/make.ts @@ -1,7 +1,7 @@ import path from 'path'; import { asyncOra } from '@electron-forge/async-ora'; -import MakerBase from '@electron-forge/maker-base'; +import { MakerBase } from '@electron-forge/maker-base'; import { ForgeArch, ForgeConfig, ForgeConfigMaker, ForgeMakeResult, ForgePlatform, IForgeResolvableMaker } from '@electron-forge/shared-types'; import { getHostArch } from '@electron/get'; import chalk from 'chalk'; diff --git a/packages/api/core/test/fixture/custom-maker.ts b/packages/api/core/test/fixture/custom-maker.ts index 157832d61b..896c3730bf 100644 --- a/packages/api/core/test/fixture/custom-maker.ts +++ b/packages/api/core/test/fixture/custom-maker.ts @@ -1,4 +1,4 @@ -import MakerBase from '@electron-forge/maker-base'; +import { MakerBase } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; interface Config { diff --git a/packages/maker/appx/src/MakerAppX.ts b/packages/maker/appx/src/MakerAppX.ts index b410c1d160..84d1b2c1e7 100644 --- a/packages/maker/appx/src/MakerAppX.ts +++ b/packages/maker/appx/src/MakerAppX.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import resolveCommand from 'cross-spawn/lib/util/resolveCommand'; import windowsStore from 'electron-windows-store'; @@ -130,4 +130,4 @@ export default class MakerAppX extends MakerBase { } } -export { MakerAppXConfig }; +export { MakerAppX, MakerAppXConfig }; diff --git a/packages/maker/base/src/Maker.ts b/packages/maker/base/src/Maker.ts index 09742611fc..7376a5d63b 100644 --- a/packages/maker/base/src/Maker.ts +++ b/packages/maker/base/src/Maker.ts @@ -169,3 +169,5 @@ export default abstract class Maker implements IForgeMaker { return `${noPrerelease}.0`; } } + +export { Maker as MakerBase }; diff --git a/packages/maker/base/test/ensure-output_spec.ts b/packages/maker/base/test/ensure-output_spec.ts index 22ed7b0c72..eab29e3cdd 100644 --- a/packages/maker/base/test/ensure-output_spec.ts +++ b/packages/maker/base/test/ensure-output_spec.ts @@ -4,7 +4,7 @@ import path from 'path'; import { expect } from 'chai'; import fs from 'fs-extra'; -import MakerBase, { EmptyConfig } from '../src/Maker'; +import { EmptyConfig, MakerBase } from '../src/Maker'; class MakerImpl extends MakerBase { name = 'test'; diff --git a/packages/maker/base/test/support_spec.ts b/packages/maker/base/test/support_spec.ts index 68ad746f3c..3946d14e06 100644 --- a/packages/maker/base/test/support_spec.ts +++ b/packages/maker/base/test/support_spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import MakerBase, { EmptyConfig } from '../src/Maker'; +import { EmptyConfig, MakerBase } from '../src/Maker'; class MakerImpl extends MakerBase { name = 'test'; diff --git a/packages/maker/base/test/version_spec.ts b/packages/maker/base/test/version_spec.ts index 591c6fd5e1..184ead56ea 100644 --- a/packages/maker/base/test/version_spec.ts +++ b/packages/maker/base/test/version_spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import MakerBase, { EmptyConfig } from '../src/Maker'; +import { EmptyConfig, MakerBase } from '../src/Maker'; class MakerImpl extends MakerBase { name = 'test'; diff --git a/packages/maker/deb/src/MakerDeb.ts b/packages/maker/deb/src/MakerDeb.ts index b484db16d2..e1d38e010e 100644 --- a/packages/maker/deb/src/MakerDeb.ts +++ b/packages/maker/deb/src/MakerDeb.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types'; import { MakerDebConfig } from './Config'; @@ -51,4 +51,4 @@ export default class MakerDeb extends MakerBase { } } -export { MakerDebConfig }; +export { MakerDeb, MakerDebConfig }; diff --git a/packages/maker/deb/test/MakerDeb_spec.ts b/packages/maker/deb/test/MakerDeb_spec.ts index 9a36d78ed3..f4a568a6cf 100644 --- a/packages/maker/deb/test/MakerDeb_spec.ts +++ b/packages/maker/deb/test/MakerDeb_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; diff --git a/packages/maker/dmg/src/MakerDMG.ts b/packages/maker/dmg/src/MakerDMG.ts index 6b244cafc8..a29ae7984c 100644 --- a/packages/maker/dmg/src/MakerDMG.ts +++ b/packages/maker/dmg/src/MakerDMG.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import fs from 'fs-extra'; @@ -40,4 +40,4 @@ export default class MakerDMG extends MakerBase { } } -export { MakerDMGConfig }; +export { MakerDMG, MakerDMGConfig }; diff --git a/packages/maker/dmg/test/MakerDMG_spec.ts b/packages/maker/dmg/test/MakerDMG_spec.ts index 04de3a9763..71fd34d405 100644 --- a/packages/maker/dmg/test/MakerDMG_spec.ts +++ b/packages/maker/dmg/test/MakerDMG_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; diff --git a/packages/maker/flatpak/src/MakerFlatpak.ts b/packages/maker/flatpak/src/MakerFlatpak.ts index a64c152eaa..0bd63ab5e0 100644 --- a/packages/maker/flatpak/src/MakerFlatpak.ts +++ b/packages/maker/flatpak/src/MakerFlatpak.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types'; import fs from 'fs-extra'; @@ -52,4 +52,4 @@ export default class MakerFlatpak extends MakerBase { } } -export { MakerFlatpak }; +export { MakerFlatpak, MakerFlatpakConfig }; diff --git a/packages/maker/flatpak/test/MakerFlatpak_spec.ts b/packages/maker/flatpak/test/MakerFlatpak_spec.ts index 06f7f6a992..3fb793b02e 100644 --- a/packages/maker/flatpak/test/MakerFlatpak_spec.ts +++ b/packages/maker/flatpak/test/MakerFlatpak_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import 'chai-as-promised'; diff --git a/packages/maker/pkg/src/MakerPKG.ts b/packages/maker/pkg/src/MakerPKG.ts index 94d5b50a82..ba4341d119 100644 --- a/packages/maker/pkg/src/MakerPKG.ts +++ b/packages/maker/pkg/src/MakerPKG.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import { flatAsync } from '@electron/osx-sign'; @@ -40,4 +40,4 @@ export default class MakerPKG extends MakerBase { } } -export { MakerPKGConfig }; +export { MakerPKG, MakerPKGConfig }; diff --git a/packages/maker/pkg/test/MakerPKG_spec.ts b/packages/maker/pkg/test/MakerPKG_spec.ts index bea5e98576..0394371193 100644 --- a/packages/maker/pkg/test/MakerPKG_spec.ts +++ b/packages/maker/pkg/test/MakerPKG_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; diff --git a/packages/maker/rpm/src/MakerRpm.ts b/packages/maker/rpm/src/MakerRpm.ts index dcd4135e29..c5d9328bac 100644 --- a/packages/maker/rpm/src/MakerRpm.ts +++ b/packages/maker/rpm/src/MakerRpm.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types'; import { MakerRpmConfig } from './Config'; @@ -49,4 +49,4 @@ export default class MakerRpm extends MakerBase { } } -export { MakerRpmConfig }; +export { MakerRpm, MakerRpmConfig }; diff --git a/packages/maker/rpm/test/MakerRpm_spec.ts b/packages/maker/rpm/test/MakerRpm_spec.ts index ab9c275671..3c237a6c6c 100644 --- a/packages/maker/rpm/test/MakerRpm_spec.ts +++ b/packages/maker/rpm/test/MakerRpm_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; diff --git a/packages/maker/snap/src/MakerSnap.ts b/packages/maker/snap/src/MakerSnap.ts index ab739f32d6..5e126dd144 100644 --- a/packages/maker/snap/src/MakerSnap.ts +++ b/packages/maker/snap/src/MakerSnap.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import { MakerSnapConfig } from './Config'; @@ -34,4 +34,4 @@ export default class MakerSnap extends MakerBase { } } -export { MakerSnapConfig }; +export { MakerSnap, MakerSnapConfig }; diff --git a/packages/maker/snap/test/MakerSnap_spec.ts b/packages/maker/snap/test/MakerSnap_spec.ts index 7f908dcd9f..bfc5427ad8 100644 --- a/packages/maker/snap/test/MakerSnap_spec.ts +++ b/packages/maker/snap/test/MakerSnap_spec.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgeArch } from '@electron-forge/shared-types'; import { expect } from 'chai'; import proxyquire from 'proxyquire'; diff --git a/packages/maker/squirrel/src/MakerSquirrel.ts b/packages/maker/squirrel/src/MakerSquirrel.ts index 963a3c6d65..f18c24e7cf 100644 --- a/packages/maker/squirrel/src/MakerSquirrel.ts +++ b/packages/maker/squirrel/src/MakerSquirrel.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import { convertVersion, createWindowsInstaller, Options as ElectronWinstallerOptions } from 'electron-winstaller'; import fs from 'fs-extra'; @@ -51,3 +51,5 @@ export default class MakerSquirrel extends MakerBase { return artifacts; } } + +export { MakerSquirrel }; diff --git a/packages/maker/wix/src/MakerWix.ts b/packages/maker/wix/src/MakerWix.ts index 04c377ec4c..f2b0a8aa1a 100644 --- a/packages/maker/wix/src/MakerWix.ts +++ b/packages/maker/wix/src/MakerWix.ts @@ -1,6 +1,6 @@ import path from 'path'; -import MakerBase, { MakerOptions } from '@electron-forge/maker-base'; +import { MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; import chalk from 'chalk'; import { MSICreator, MSICreatorOptions } from 'electron-wix-msi/lib/creator'; @@ -52,4 +52,4 @@ export default class MakerWix extends MakerBase { } } -export { MakerWixConfig }; +export { MakerWix, MakerWixConfig }; diff --git a/packages/maker/zip/src/MakerZIP.ts b/packages/maker/zip/src/MakerZIP.ts index 7648d3bad9..83d25fcd5f 100644 --- a/packages/maker/zip/src/MakerZIP.ts +++ b/packages/maker/zip/src/MakerZIP.ts @@ -1,7 +1,7 @@ import path from 'path'; import { promisify } from 'util'; -import MakerBase, { EmptyConfig, MakerOptions } from '@electron-forge/maker-base'; +import { EmptyConfig, MakerBase, MakerOptions } from '@electron-forge/maker-base'; import { ForgePlatform } from '@electron-forge/shared-types'; export type MakerZIPConfig = EmptyConfig; @@ -28,3 +28,5 @@ export default class MakerZIP extends MakerBase { return [zipPath]; } } + +export { MakerZIP }; diff --git a/packages/plugin/auto-unpack-natives/src/AutoUnpackNativesPlugin.ts b/packages/plugin/auto-unpack-natives/src/AutoUnpackNativesPlugin.ts index d7b1adb9fa..ce894519f5 100644 --- a/packages/plugin/auto-unpack-natives/src/AutoUnpackNativesPlugin.ts +++ b/packages/plugin/auto-unpack-natives/src/AutoUnpackNativesPlugin.ts @@ -1,4 +1,4 @@ -import PluginBase from '@electron-forge/plugin-base'; +import { PluginBase } from '@electron-forge/plugin-base'; import { ForgeConfig, ForgeHookFn } from '@electron-forge/shared-types'; import { AutoUnpackNativesConfig } from './Config'; @@ -34,4 +34,4 @@ export default class AutoUnpackNativesPlugin extends PluginBase implements IForgePlugin { return false; } } + +export { Plugin as PluginBase }; diff --git a/packages/plugin/compile/src/CompilePlugin.ts b/packages/plugin/compile/src/CompilePlugin.ts index bd2bce4784..18e5700fe6 100644 --- a/packages/plugin/compile/src/CompilePlugin.ts +++ b/packages/plugin/compile/src/CompilePlugin.ts @@ -1,12 +1,12 @@ import * as path from 'path'; -import PluginBase, { StartOptions } from '@electron-forge/plugin-base'; +import { PluginBase, StartOptions } from '@electron-forge/plugin-base'; import { ForgeHookFn } from '@electron-forge/shared-types'; import { CompilePluginConfig } from './Config'; import { createCompileHook } from './lib/compile-hook'; -export default class LocalElectronPlugin extends PluginBase { +export default class CompileElectronPlugin extends PluginBase { name = 'electron-compile'; private dir!: string; @@ -35,4 +35,4 @@ export default class LocalElectronPlugin extends PluginBase } } -export { CompilePluginConfig }; +export { CompileElectronPlugin, CompilePluginConfig }; diff --git a/packages/plugin/electronegativity/src/ElectronegativityPlugin.ts b/packages/plugin/electronegativity/src/ElectronegativityPlugin.ts index 6a0bae1939..33dba9e083 100644 --- a/packages/plugin/electronegativity/src/ElectronegativityPlugin.ts +++ b/packages/plugin/electronegativity/src/ElectronegativityPlugin.ts @@ -1,5 +1,5 @@ import runElectronegativity from '@doyensec/electronegativity'; -import PluginBase from '@electron-forge/plugin-base'; +import { PluginBase } from '@electron-forge/plugin-base'; import { ForgeConfig, ForgeHookFn } from '@electron-forge/shared-types'; // To be more precise, postPackage options we care about. @@ -78,3 +78,5 @@ export default class ElectronegativityPlugin extends PluginBase implements IForgePublisher { throw new Error(`Publisher ${this.name} did not implement the publish method`); } } + +export { Publisher as PublisherBase }; diff --git a/packages/publisher/bitbucket/src/PublisherBitbucket.ts b/packages/publisher/bitbucket/src/PublisherBitbucket.ts index 9cf0f9e4ca..223e0bb1c4 100644 --- a/packages/publisher/bitbucket/src/PublisherBitbucket.ts +++ b/packages/publisher/bitbucket/src/PublisherBitbucket.ts @@ -1,7 +1,7 @@ import path from 'path'; import { asyncOra } from '@electron-forge/async-ora'; -import PublisherBase, { PublisherOptions } from '@electron-forge/publisher-base'; +import { PublisherBase, PublisherOptions } from '@electron-forge/publisher-base'; import FormData from 'form-data'; import fs from 'fs-extra'; import fetch from 'node-fetch'; @@ -84,4 +84,4 @@ export default class PublisherBitbucket extends PublisherBase { } } -export { PublisherERSConfig }; +export { PublisherERS, PublisherERSConfig }; diff --git a/packages/publisher/github/src/PublisherGithub.ts b/packages/publisher/github/src/PublisherGithub.ts index 3ad50417c1..a84e965309 100644 --- a/packages/publisher/github/src/PublisherGithub.ts +++ b/packages/publisher/github/src/PublisherGithub.ts @@ -1,7 +1,7 @@ import path from 'path'; import { asyncOra } from '@electron-forge/async-ora'; -import PublisherBase, { PublisherOptions } from '@electron-forge/publisher-base'; +import { PublisherBase, PublisherOptions } from '@electron-forge/publisher-base'; import { ForgeMakeResult } from '@electron-forge/shared-types'; import { GetResponseDataTypeFromEndpointMethod } from '@octokit/types'; import fs from 'fs-extra'; @@ -131,4 +131,4 @@ export default class PublisherGithub extends PublisherBase { } } -export { PublisherS3Config }; +export { PublisherS3, PublisherS3Config }; diff --git a/packages/publisher/snapcraft/src/PublisherSnapcraft.ts b/packages/publisher/snapcraft/src/PublisherSnapcraft.ts index d0ed390044..929005cfa7 100644 --- a/packages/publisher/snapcraft/src/PublisherSnapcraft.ts +++ b/packages/publisher/snapcraft/src/PublisherSnapcraft.ts @@ -1,7 +1,7 @@ import path from 'path'; import { asyncOra } from '@electron-forge/async-ora'; -import PublisherBase, { PublisherOptions } from '@electron-forge/publisher-base'; +import { PublisherBase, PublisherOptions } from '@electron-forge/publisher-base'; import fs from 'fs-extra'; import { PublisherSnapcraftConfig } from './Config'; @@ -41,4 +41,4 @@ export default class PublisherSnapcraft extends PublisherBase