Skip to content

Commit edd2cd7

Browse files
fix: address review comments
Change-Id: Ie57921d60436e4013ade926c662afd03d3e82317
1 parent e2dfa4d commit edd2cd7

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

build/lib/electron.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ function getElectron(arch) {
9898
.pipe(vfs.dest('.build/electron'));
9999
};
100100
}
101-
async function main(arch = process.arch) {
102-
if (process.env["npm_config_arch"]) {
103-
arch = process.env["npm_config_arch"];
104-
}
101+
async function main(arch = process.env["npm_config_arch"] || process.arch) {
105102
const version = getElectronVersion();
106103
const electronPath = path.join(root, '.build', 'electron');
107104
const versionFile = path.join(electronPath, 'version');

build/lib/electron.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ function getElectron(arch: string): () => NodeJS.ReadWriteStream {
107107
};
108108
}
109109

110-
async function main(arch = process.arch): Promise<void> {
111-
if (process.env["npm_config_arch"]) {
112-
arch = process.env["npm_config_arch"] as string;
113-
}
110+
async function main(arch = process.env["npm_config_arch"] || process.arch): Promise<void> {
114111
const version = getElectronVersion();
115112
const electronPath = path.join(root, '.build', 'electron');
116113
const versionFile = path.join(electronPath, 'version');

build/npm/postinstall.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,14 @@ function yarnInstall(location, opts) {
2323
const args = original.filter(arg => arg === '--ignore-optional' || arg === '--frozen-lockfile');
2424

2525
console.log(`Installing dependencies in ${location}...`);
26-
const oldConfigArch = process.env['npm_config_arch']
27-
if (location.startsWith("remote") && oldConfigArch == "arm64") {
28-
// Temporarily set remote arch to x86, because remote portion builds
26+
if (location.startsWith("remote") && process.env["npm_config_arch"] == "arm64") {
27+
// Temporarily set remote arch to x86, because the remote portion builds
2928
// against node, which is not consistently supported on Windows on Arm
3029
// (yet).
31-
process.env["npm_config_arch"] = "ia32"
30+
opts.npm_config_arch = "ia32"
3231
}
3332
console.log(`$ yarn ${args.join(' ')}`);
3433
const result = cp.spawnSync(yarn, args, opts);
35-
// Restore the architecture, if temporarily swapped.
36-
process.env["npm_config_arch"] = oldConfigArch
3734
if (result.error || result.status !== 0) {
3835
process.exit(1);
3936
}

0 commit comments

Comments
 (0)