From e3af089d8387874b3e416005df888ed3c41bb72c Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Sun, 11 Jul 2021 19:30:30 +0100 Subject: [PATCH] feat(core): add `platform` and `arch` to `generateAssets` hook parameters (#2327) * Support WSL --- packages/api/core/src/api/package.ts | 2 +- packages/api/core/src/api/start.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/api/core/src/api/package.ts b/packages/api/core/src/api/package.ts index e8a9be7954..f174b3c0b3 100644 --- a/packages/api/core/src/api/package.ts +++ b/packages/api/core/src/api/package.ts @@ -200,7 +200,7 @@ export default async ({ throw new Error('config.forge.packagerConfig.prebuiltAsar is not supported by Electron Forge'); } - await runHook(forgeConfig, 'generateAssets'); + await runHook(forgeConfig, 'generateAssets', platform, arch); await runHook(forgeConfig, 'prePackage'); d('packaging with options', packageOpts); diff --git a/packages/api/core/src/api/start.ts b/packages/api/core/src/api/start.ts index 3c4deadf32..967eaf2765 100644 --- a/packages/api/core/src/api/start.ts +++ b/packages/api/core/src/api/start.ts @@ -44,15 +44,18 @@ export default async ({ throw new Error(`Please set your application's 'version' in '${dir}/package.json'.`); } + const platform = process.env.npm_config_platform || process.platform; + const arch = process.env.npm_config_arch || process.arch; + await rebuild( dir, await getElectronVersion(dir, packageJSON), - process.platform as ForgePlatform, - process.arch as ForgeArch, + platform as ForgePlatform, + arch as ForgeArch, forgeConfig.electronRebuildConfig, ); - await runHook(forgeConfig, 'generateAssets'); + await runHook(forgeConfig, 'generateAssets', platform, arch); let lastSpawned: ElectronProcess | null = null;