Skip to content

Commit

Permalink
fix(plugin-fuses): resetAdHocDarwinSignature rules on Mac (#3190)
Browse files Browse the repository at this point in the history
* fix(plugin-fuses): set `resetAdHocDarwinSignature` to `true` on `platform=mas` when the `osxSign` config is missing

* docs(plugin-fuses): fixed minor typo in the README
  • Loading branch information
erikian committed Mar 10, 2023
1 parent 3e6729b commit 4676826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/plugin/fuses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This plugin allows flipping [Electron Fuses](https://github.com/electron/fuses)

## Usage

Install `@electron-forge/plugin-fuses` and `@electron/fuses` as dev dependencies and add this plugin to the `plugins` array in your Forge configuration::
Install `@electron-forge/plugin-fuses` and `@electron/fuses` as dev dependencies and add this plugin to the `plugins` array in your Forge configuration:
```shell
# Yarn
yarn add --dev @electron-forge/plugin-fuses @electron/fuses
Expand Down
8 changes: 5 additions & 3 deletions packages/plugin/fuses/src/FusesPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

import { namedHookWithTaskFn, PluginBase } from '@electron-forge/plugin-base';
import { ForgeMultiHookMap } from '@electron-forge/shared-types';
import { ForgeMultiHookMap, ForgePlatform } from '@electron-forge/shared-types';
import { flipFuses, FuseConfig } from '@electron/fuses';

import { getElectronExecutablePath } from './util/getElectronExecutablePath';
Expand All @@ -22,9 +22,11 @@ export default class FusesPlugin extends PluginBase<FuseConfig> {
packageAfterCopy: namedHookWithTaskFn<'packageAfterCopy'>(async (listrTask, resolvedForgeConfig, resourcesPath, electronVersion, platform, arch) => {
const { fusesConfig } = this;

const applePlatforms: ForgePlatform[] = ['darwin', 'mas'];

if (Object.keys(fusesConfig).length) {
const pathToElectronExecutable = getElectronExecutablePath({
appName: ['darwin', 'mas'].includes(platform) ? 'Electron' : 'electron',
appName: applePlatforms.includes(platform) ? 'Electron' : 'electron',
basePath: path.resolve(resourcesPath, '../..'),
platform,
});
Expand All @@ -33,7 +35,7 @@ export default class FusesPlugin extends PluginBase<FuseConfig> {
const hasOSXSignConfig = (typeof osxSignConfig === 'object' && Boolean(Object.keys(osxSignConfig).length)) || Boolean(osxSignConfig);

await flipFuses(pathToElectronExecutable, {
resetAdHocDarwinSignature: !hasOSXSignConfig && platform === 'darwin' && arch === 'arm64',
resetAdHocDarwinSignature: !hasOSXSignConfig && applePlatforms.includes(platform) && arch === 'arm64',
...this.fusesConfig,
});
}
Expand Down

0 comments on commit 4676826

Please sign in to comment.