@electron-forge/plugin-fuses 6.2.1 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electron-forge/plugin-fuses",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "A plugin for flipping Electron Fuses in Electron Forge",
|
|
5
5
|
"repository": "https://github.com/electron/forge",
|
|
6
6
|
"author": "Erik Moura <erikian@erikian.dev>",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"main": "dist/FusesPlugin.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
+
"src",
|
|
11
12
|
"package.json",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
@@ -30,11 +31,11 @@
|
|
|
30
31
|
"node": ">= 14.17.5"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@electron-forge/plugin-base": "6.
|
|
34
|
-
"@electron-forge/shared-types": "6.
|
|
34
|
+
"@electron-forge/plugin-base": "6.4.0",
|
|
35
|
+
"@electron-forge/shared-types": "6.4.0"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "0cd8fb7ed8356c304790c8ba764cb3afa35e8f51"
|
|
40
41
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { namedHookWithTaskFn, PluginBase } from '@electron-forge/plugin-base';
|
|
4
|
+
import { ForgeMultiHookMap, ForgePlatform } from '@electron-forge/shared-types';
|
|
5
|
+
import { flipFuses, FuseConfig } from '@electron/fuses';
|
|
6
|
+
|
|
7
|
+
import { getElectronExecutablePath } from './util/getElectronExecutablePath';
|
|
8
|
+
|
|
9
|
+
export default class FusesPlugin extends PluginBase<FuseConfig> {
|
|
10
|
+
name = 'fuses';
|
|
11
|
+
|
|
12
|
+
fusesConfig = {} as FuseConfig;
|
|
13
|
+
|
|
14
|
+
constructor(fusesConfig: FuseConfig) {
|
|
15
|
+
super(fusesConfig);
|
|
16
|
+
|
|
17
|
+
this.fusesConfig = fusesConfig;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getHooks(): ForgeMultiHookMap {
|
|
21
|
+
return {
|
|
22
|
+
packageAfterCopy: namedHookWithTaskFn<'packageAfterCopy'>(async (listrTask, resolvedForgeConfig, resourcesPath, electronVersion, platform, arch) => {
|
|
23
|
+
const { fusesConfig } = this;
|
|
24
|
+
|
|
25
|
+
const applePlatforms: ForgePlatform[] = ['darwin', 'mas'];
|
|
26
|
+
|
|
27
|
+
if (Object.keys(fusesConfig).length) {
|
|
28
|
+
const pathToElectronExecutable = getElectronExecutablePath({
|
|
29
|
+
appName: applePlatforms.includes(platform) ? 'Electron' : 'electron',
|
|
30
|
+
basePath: path.resolve(resourcesPath, '../..'),
|
|
31
|
+
platform,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const osxSignConfig = resolvedForgeConfig.packagerConfig.osxSign;
|
|
35
|
+
const hasOSXSignConfig = (typeof osxSignConfig === 'object' && Boolean(Object.keys(osxSignConfig).length)) || Boolean(osxSignConfig);
|
|
36
|
+
|
|
37
|
+
await flipFuses(pathToElectronExecutable, {
|
|
38
|
+
resetAdHocDarwinSignature: !hasOSXSignConfig && applePlatforms.includes(platform) && arch === 'arm64',
|
|
39
|
+
...this.fusesConfig,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, 'Flipping Fuses'),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { FusesPlugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { ForgePlatform } from '@electron-forge/shared-types';
|
|
4
|
+
|
|
5
|
+
type GetElectronExecutablePathParams = {
|
|
6
|
+
appName: string;
|
|
7
|
+
basePath: string;
|
|
8
|
+
platform: ForgePlatform;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function getElectronExecutablePath({ appName, basePath, platform }: GetElectronExecutablePathParams): string {
|
|
12
|
+
return path.join(
|
|
13
|
+
basePath,
|
|
14
|
+
['darwin', 'mas'].includes(platform) ? path.join('MacOS', appName) : [appName, process.platform === 'win32' ? '.exe' : ''].join('')
|
|
15
|
+
);
|
|
16
|
+
}
|