Skip to content

Commit c37bd00

Browse files
committed
fix: --ia32 parameter not working as expected anymore
Close #1348
1 parent 8f6247a commit c37bd00

File tree

6 files changed

+62
-32
lines changed

6 files changed

+62
-32
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cache:
66
- '%USERPROFILE%\.electron'
77

88
environment:
9-
TEST_FILES: BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest
9+
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest
1010

1111
install:
1212
- ps: Install-Product node 6 x64

packages/electron-builder/src/targets/targetFactory.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export function computeArchToTargetNamesMap(raw: Map<Arch, string[]>, options: P
1414
}
1515
}
1616

17+
const defaultArchs: Array<string> = raw.size === 0 ? [platform === Platform.MAC ? "x64" : process.arch] : Array.from(raw.keys()).map(it => Arch[it])
1718
const result = new Map(raw)
18-
const defaultArch = platform === Platform.MAC ? "x64" : process.arch
1919
for (const target of asArray(options.target).map<TargetConfig>(it => typeof it === "string" ? {target: it} : it)) {
2020
let name = target.target
2121
let archs = target.arch
@@ -27,13 +27,15 @@ export function computeArchToTargetNamesMap(raw: Map<Arch, string[]>, options: P
2727
}
2828
}
2929

30-
for (const arch of asArray(archs || defaultArch)) {
30+
for (const arch of archs == null ? defaultArchs : asArray(archs)) {
3131
addValue(result, archFromString(arch), name)
3232
}
3333
}
3434

3535
if (result.size === 0) {
36-
result.set(archFromString(defaultArch), [])
36+
for (const arch of defaultArchs) {
37+
result.set(archFromString(arch), [])
38+
}
3739
}
3840

3941
return result

test/out/__snapshots__/ExtraBuildTest.js.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ Object {
2727
}
2828
`;
2929

30+
exports[`override targets in the config - only arch 1`] = `
31+
Object {
32+
"win": Array [
33+
Object {
34+
"file": "Test App ßW Setup 1.1.0.exe",
35+
"safeArtifactName": "TestApp-Setup-1.1.0.exe",
36+
},
37+
],
38+
}
39+
`;
40+
3041
exports[`override targets in the config 1`] = `
3142
Object {
3243
"linux": Array [],

test/src/ExtraBuildTest.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DIR_TARGET, Platform } from "electron-builder"
1+
import { Arch, DIR_TARGET, Platform } from "electron-builder"
22
import { build } from "electron-builder/out/builder"
33
import { move } from "fs-extra-p"
44
import * as path from "path"
@@ -54,12 +54,12 @@ test.ifAll.ifLinuxOrDevMac("prepackaged", app({
5454
}
5555
}))
5656

57-
test.ifAll.ifLinuxOrDevMac("override targets in the config", app({
57+
test.ifAll.ifDevOrWinCi("override targets in the config", app({
5858
targets: linuxDirTarget,
5959
}, {
6060
packed: async (context) => {
6161
await build({
62-
project: context.projectDir,
62+
projectDir: context.projectDir,
6363
linux: ["deb"],
6464
config: {
6565
publish: null,
@@ -77,6 +77,23 @@ test.ifAll.ifLinuxOrDevMac("override targets in the config", app({
7777
}
7878
}))
7979

80+
81+
test.ifAll.ifDevOrWinCi("override targets in the config - only arch", app({
82+
targets: Platform.WINDOWS.createTarget(null, Arch.ia32),
83+
config: {
84+
// https://github.com/electron-userland/electron-builder/issues/1348
85+
win: {
86+
target: [
87+
"nsis",
88+
],
89+
},
90+
},
91+
}, {
92+
packed: async (context) => {
93+
await assertThat(path.join(context.projectDir, "dist", "win-unpacked")).doesNotExist()
94+
},
95+
}))
96+
8097
test.ifAll.ifDevOrLinuxCi("scheme validation", appThrows({
8198
targets: linuxDirTarget,
8299
config: <any>{

test/src/helpers/packTester.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async function packAndCheck(packagerOptions: PackagerOptions, checkOptions: Asse
192192
return result
193193
})
194194
}
195-
195+
196196
expect(objectToCompare).toMatchSnapshot()
197197

198198
c: for (const [platform, archToType] of packagerOptions.targets) {

yarn.lock

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ ajv-keywords@^2.0.1-beta.1:
9191
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.0.1-beta.1.tgz#f724f5495a1c71b09d1772560df8a4c5a4d018a5"
9292

9393
ajv@^4.9.1:
94-
version "4.11.4"
95-
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.4.tgz#ebf3a55d4b132ea60ff5847ae85d2ef069960b45"
94+
version "4.11.5"
95+
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd"
9696
dependencies:
9797
co "^4.6.0"
9898
json-stable-stringify "^1.0.1"
@@ -301,15 +301,15 @@ babel-code-frame@^6.20.0, babel-code-frame@^6.22.0:
301301
esutils "^2.0.2"
302302
js-tokens "^3.0.0"
303303

304-
babel-core@^6.0.0, babel-core@^6.23.0, babel-core@^6.23.1:
305-
version "6.23.1"
306-
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.23.1.tgz#c143cb621bb2f621710c220c5d579d15b8a442df"
304+
babel-core@^6.0.0, babel-core@^6.23.1, babel-core@^6.24.0:
305+
version "6.24.0"
306+
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02"
307307
dependencies:
308308
babel-code-frame "^6.22.0"
309-
babel-generator "^6.23.0"
309+
babel-generator "^6.24.0"
310310
babel-helpers "^6.23.0"
311311
babel-messages "^6.23.0"
312-
babel-register "^6.23.0"
312+
babel-register "^6.24.0"
313313
babel-runtime "^6.22.0"
314314
babel-template "^6.23.0"
315315
babel-traverse "^6.23.1"
@@ -325,9 +325,9 @@ babel-core@^6.0.0, babel-core@^6.23.0, babel-core@^6.23.1:
325325
slash "^1.0.0"
326326
source-map "^0.5.0"
327327

328-
babel-generator@^6.18.0, babel-generator@^6.23.0:
329-
version "6.23.0"
330-
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.23.0.tgz#6b8edab956ef3116f79d8c84c5a3c05f32a74bc5"
328+
babel-generator@^6.18.0, babel-generator@^6.24.0:
329+
version "6.24.0"
330+
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56"
331331
dependencies:
332332
babel-messages "^6.23.0"
333333
babel-runtime "^6.22.0"
@@ -474,11 +474,11 @@ babel-preset-jest@^19.0.0:
474474
dependencies:
475475
babel-plugin-jest-hoist "^19.0.0"
476476

477-
babel-register@^6.23.0:
478-
version "6.23.0"
479-
resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.23.0.tgz#c9aa3d4cca94b51da34826c4a0f9e08145d74ff3"
477+
babel-register@^6.24.0:
478+
version "6.24.0"
479+
resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.0.tgz#5e89f8463ba9970356d02eb07dabe3308b080cfd"
480480
dependencies:
481-
babel-core "^6.23.0"
481+
babel-core "^6.24.0"
482482
babel-runtime "^6.22.0"
483483
core-js "^2.4.0"
484484
home-or-tmp "^2.0.0"
@@ -2006,8 +2006,8 @@ jsdoc2md-stats@^2.0.0:
20062006
app-usage-stats "^0.5.0"
20072007

20082008
jsdom@^9.11.0:
2009-
version "9.11.0"
2010-
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.11.0.tgz#a95b0304e521a2ca5a63c6ea47bf7708a7a84591"
2009+
version "9.12.0"
2010+
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4"
20112011
dependencies:
20122012
abab "^1.0.3"
20132013
acorn "^4.0.4"
@@ -3047,8 +3047,8 @@ strip-json-comments@~2.0.1:
30473047
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
30483048

30493049
sumchecker@^2.0.1:
3050-
version "2.0.1"
3051-
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.1.tgz#9ce42ecefc5fce2c602d3623315c52b57a2d69dd"
3050+
version "2.0.2"
3051+
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e"
30523052
dependencies:
30533053
debug "^2.2.0"
30543054

@@ -3220,8 +3220,8 @@ tslint@^4.5.1:
32203220
update-notifier "^2.0.0"
32213221

32223222
tsutils@^1.1.0:
3223-
version "1.2.2"
3224-
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.2.2.tgz#7e165c601367b9f89200b97ff47d9e38d1a6e4c8"
3223+
version "1.3.0"
3224+
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.3.0.tgz#dd86cb304f7a2e86c012deade2f8d0f886f57808"
32253225

32263226
tunnel-agent@^0.6.0:
32273227
version "0.6.0"
@@ -3413,8 +3413,8 @@ whatwg-encoding@^1.0.1:
34133413
iconv-lite "0.4.13"
34143414

34153415
whatwg-url@^4.3.0:
3416-
version "4.5.0"
3417-
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.5.0.tgz#79bb6f0e370a4dda1cbc8f3062a490cf8bbb09ea"
3416+
version "4.5.1"
3417+
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.5.1.tgz#ba634f630ff0778212c52ea9055d2d061380b1bb"
34183418
dependencies:
34193419
tr46 "~0.0.3"
34203420
webidl-conversions "^3.0.0"
@@ -3555,8 +3555,8 @@ y18n@^3.2.1:
35553555
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
35563556

35573557
yallist@^2.0.0:
3558-
version "2.0.0"
3559-
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.0.0.tgz#306c543835f09ee1a4cb23b7bce9ab341c91cdd4"
3558+
version "2.1.0"
3559+
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.0.tgz#3a0f3b45f42cb60f822c92f69ade2bb88beb1ae0"
35603560

35613561
yargs-parser@^4.2.0:
35623562
version "4.2.1"

0 commit comments

Comments
 (0)