fix(desktop): download target Electron for cross-platform packaging
This commit is contained in:
1 parent
b29cf1ad11
commit
8bd662ea92
1 file changed
+13
-2
@@ -36,7 +36,18 @@ function electronBuilderCli() {
|
||||
return path.join(path.dirname(pkgJson), rel)
|
||||
}
|
||||
|
||||
const dist = electronDistDir()
|
||||
const cliArgs = process.argv.slice(2)
|
||||
// An installed Electron dist belongs to the host. Cross-platform packaging
|
||||
// must download the requested target instead of copying the host executable.
|
||||
const crossPlatform =
|
||||
(cliArgs.includes('--win') && process.platform !== 'win32') ||
|
||||
(cliArgs.includes('--mac') && process.platform !== 'darwin') ||
|
||||
(cliArgs.includes('--linux') && process.platform !== 'linux')
|
||||
const crossArch =
|
||||
(cliArgs.includes('--x64') && process.arch !== 'x64') ||
|
||||
(cliArgs.includes('--arm64') && process.arch !== 'arm64') ||
|
||||
(cliArgs.includes('--ia32') && process.arch !== 'ia32')
|
||||
const dist = crossPlatform || crossArch ? null : electronDistDir()
|
||||
// Local `hermes desktop` builds only ever package (--dir or dist), never
|
||||
// publish a GitHub release — no CI workflow drives this script. But the npm
|
||||
// lifecycle env sets CI=1 (so esbuild's postinstall doesn't try interactive
|
||||
@@ -55,7 +66,7 @@ if (dist && fs.existsSync(distBinary(dist))) {
|
||||
"via @electron/get (electronVersion + ELECTRON_MIRROR)."
|
||||
)
|
||||
}
|
||||
args.push(...process.argv.slice(2))
|
||||
args.push(...cliArgs)
|
||||
|
||||
const result = spawnSync(process.execPath, [electronBuilderCli(), ...args], {
|
||||
stdio: "inherit",
|
||||
|
||||
Reference in new issue
Block a user