Skip to content

Commit

Permalink
Update Electron Forge configuration for new types.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacingBat3 committed Oct 28, 2022
1 parent 1e7c451 commit f626646
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion sources/code/build/forge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Forge types

import type { ForgeConfig } from "@electron-forge/shared-types";
import type { ForgeConfig, ResolvedForgeConfig, ForgeHookMap } from "@electron-forge/shared-types";
import type { OfficialPlatform } from "electron-packager";
export type ForgePlatform = Exclude<OfficialPlatform | NodeJS.Platform, "android">;

Expand Down Expand Up @@ -37,6 +37,8 @@ type MPConfig = unknown | {
};

interface MPBase {
/** Whenever given maker should be used. */
enabled?: boolean;
/** A Node.js package name that provides the maker or publisher functionality. */
name: string;
/** Overrides the platform that this maker or publisher will be used on. */
Expand Down Expand Up @@ -98,4 +100,8 @@ export type ForgeConfigFile = Redeclare<Partial<ForgeConfig>, {
publishers?: (
PublisherGitHub
)[];
hooks?: Redeclare<ForgeHookMap, {
packageAfterCopy: (ForgeConfig: ResolvedForgeConfig, path:string, electronVersion: string, platform: ForgePlatform) => unknown;
packageAfterExtract: (ForgeConfig: ResolvedForgeConfig, path:string, electronVersion: string, platform: ForgePlatform) => unknown;
}>;
}>;
4 changes: 2 additions & 2 deletions sources/code/build/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const config: ForgeConfigFile = {
}
],
hooks: {
packageAfterCopy: async (_ForgeConfig, path:string, _electronVersion: string, platform: ForgePlatform) => {
packageAfterCopy: async (_ForgeConfig, path, _electronVersion, platform) => {
/** Generates `buildInfo.json` file and saves it somewhe. */
async function writeBuildInfo() {
const buildConfig: buildInfo = {
Expand All @@ -189,7 +189,7 @@ const config: ForgeConfigFile = {
]);
},
// Hardened Electron binary via Electron Fuses feature.
packageAfterExtract: (_ForgeConfig, path:string, _electronVersion: string, platform: ForgePlatform) =>
packageAfterExtract: (_ForgeConfig, path, _electronVersion, platform) =>
flipFuses(resolve(path, getElectronPath(platform)), {
version: FuseVersion.V1,
[FuseV1Options.OnlyLoadAppFromAsar]: env.asar,
Expand Down

0 comments on commit f626646

Please sign in to comment.