Skip to content

Commit f545d1e

Browse files
committed
fix(mac): generate latest-mac.yml for zip target
Close #2313
1 parent e35846a commit f545d1e

File tree

9 files changed

+53
-66
lines changed

9 files changed

+53
-66
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@
7373
"@types/ejs": "^2.5.0",
7474
"@types/electron-is-dev": "^0.3.0",
7575
"@types/ini": "^1.3.29",
76-
"@types/jest": "^22.1.0",
76+
"@types/jest": "^22.1.1",
7777
"@types/js-yaml": "^3.10.1",
7878
"@types/lodash.isequal": "^4.5.2",
7979
"@types/node-emoji": "^1.8.0",
8080
"@types/sanitize-filename": "^1.1.28",
8181
"@types/sax": "^1.0.0",
82-
"@types/semver": "^5.4.0",
82+
"@types/semver": "^5.5.0",
8383
"@types/source-map-support": "^0.4.0",
8484
"@types/stat-mode": "^0.2.0",
8585
"babel-preset-ts-node6-bluebird": "^1.0.1",

packages/electron-builder-lib/src/macPackager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
6464
break
6565

6666
case "zip":
67-
const electronUpdaterCompatibility = this.platformSpecificBuildOptions.electronUpdaterCompatibility
68-
mapper(name, outDir => new ArchiveTarget(name, outDir, this, targets.some(it => it === "dmg") && (electronUpdaterCompatibility == null || semver.satisfies("2.16.0", electronUpdaterCompatibility))))
67+
// https://github.com/electron-userland/electron-builder/issues/2313
68+
mapper(name, outDir => new ArchiveTarget(name, outDir, this, true))
6969
break
7070

7171
case "pkg":

packages/electron-builder-lib/src/publish/PublishManager.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ export class PublishManager implements PublishContext {
150150
}
151151
}
152152

153-
if (event.isWriteUpdateInfo && target != null && eventFile != null && !this.cancellationToken.cancelled) {
154-
if (packager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target)) {
155-
this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))
156-
}
153+
if (event.isWriteUpdateInfo && target != null && eventFile != null &&
154+
!this.cancellationToken.cancelled &&
155+
(packager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target))) {
156+
this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))
157157
}
158158
}
159159

@@ -169,6 +169,7 @@ export class PublishManager implements PublishContext {
169169
return publisher
170170
}
171171

172+
// noinspection JSUnusedGlobalSymbols
172173
cancelTasks() {
173174
this.taskManager.cancelTasks()
174175
this.nameToPublisher.clear()

packages/electron-publish/src/gitHubPublisher.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ export class GitHubPublisher extends HttpPublisher {
7272

7373
if (isEnvTrue(process.env.EP_DRAFT)) {
7474
this.releaseType = "draft"
75+
log.info({reason: "env EP_DRAFT is set to true"}, "GitHub provider release type is set to draft")
7576
}
7677
else if (isEnvTrue(process.env.EP_PRELEASE)) {
7778
this.releaseType = "prerelease"
79+
log.info({reason: "env EP_PRELEASE is set to true"}, "GitHub provider release type is set to prerelease")
7880
}
7981
else if (info.releaseType != null) {
8082
this.releaseType = info.releaseType

test/out/__snapshots__/PublishManagerTest.js.snap

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,135 +2,117 @@
22

33
exports[`generic, github and spaces 1`] = `
44
Object {
5-
"linux": Array [
6-
Object {
7-
"arch": "x64",
8-
"file": "TestApp-1.1.0-x86_64.AppImage",
9-
"updateInfo": Object {
10-
"blockMapSize": "@blockMapSize",
11-
"sha512": "@sha512",
12-
"size": "@size",
13-
},
14-
},
5+
"mac": Array [
156
Object {
16-
"file": "alpha-linux.yml",
7+
"file": "alpha-mac.yml",
178
"fileContent": Object {
189
"files": Array [
1910
Object {
20-
"blockMapSize": "@blockMapSize",
2111
"sha512": "@sha512",
22-
"size": "@size",
23-
"url": "TestApp-1.1.0-x86_64.AppImage",
12+
"url": "TestApp-1.1.0-mac.zip",
2413
},
2514
],
26-
"path": "TestApp-1.1.0-x86_64.AppImage",
15+
"path": "Test App ßW-1.1.0-mac.zip",
2716
"releaseDate": "@releaseDate",
2817
"sha512": "@sha512",
2918
"version": "1.1.0",
3019
},
3120
},
3221
Object {
33-
"file": "alpha-linux.yml",
22+
"file": "alpha-mac.yml",
3423
"fileContent": Object {
3524
"files": Array [
3625
Object {
37-
"blockMapSize": "@blockMapSize",
3826
"sha512": "@sha512",
39-
"size": "@size",
40-
"url": "TestApp-1.1.0-x86_64.AppImage",
27+
"url": "TestApp-1.1.0-mac.zip",
4128
},
4229
],
43-
"path": "TestApp-1.1.0-x86_64.AppImage",
30+
"path": "Test App ßW-1.1.0-mac.zip",
4431
"releaseDate": "@releaseDate",
4532
"sha512": "@sha512",
4633
"version": "1.1.0",
4734
},
4835
},
4936
Object {
50-
"file": "beta-linux.yml",
37+
"file": "beta-mac.yml",
5138
"fileContent": Object {
5239
"files": Array [
5340
Object {
54-
"blockMapSize": "@blockMapSize",
5541
"sha512": "@sha512",
56-
"size": "@size",
57-
"url": "TestApp-1.1.0-x86_64.AppImage",
42+
"url": "TestApp-1.1.0-mac.zip",
5843
},
5944
],
60-
"path": "TestApp-1.1.0-x86_64.AppImage",
45+
"path": "Test App ßW-1.1.0-mac.zip",
6146
"releaseDate": "@releaseDate",
6247
"sha512": "@sha512",
6348
"version": "1.1.0",
6449
},
6550
},
6651
Object {
67-
"file": "beta-linux.yml",
52+
"file": "beta-mac.yml",
6853
"fileContent": Object {
6954
"files": Array [
7055
Object {
71-
"blockMapSize": "@blockMapSize",
7256
"sha512": "@sha512",
73-
"size": "@size",
74-
"url": "TestApp-1.1.0-x86_64.AppImage",
57+
"url": "TestApp-1.1.0-mac.zip",
7558
},
7659
],
77-
"path": "TestApp-1.1.0-x86_64.AppImage",
60+
"path": "Test App ßW-1.1.0-mac.zip",
7861
"releaseDate": "@releaseDate",
7962
"sha512": "@sha512",
8063
"version": "1.1.0",
8164
},
8265
},
8366
Object {
84-
"file": "latest-linux.yml",
67+
"file": "latest-mac.yml",
8568
"fileContent": Object {
8669
"files": Array [
8770
Object {
88-
"blockMapSize": "@blockMapSize",
8971
"sha512": "@sha512",
90-
"size": "@size",
91-
"url": "TestApp-1.1.0-x86_64.AppImage",
72+
"url": "TestApp-1.1.0-mac.zip",
9273
},
9374
],
94-
"path": "TestApp-1.1.0-x86_64.AppImage",
75+
"path": "Test App ßW-1.1.0-mac.zip",
9576
"releaseDate": "@releaseDate",
9677
"sha512": "@sha512",
9778
"version": "1.1.0",
9879
},
9980
},
10081
Object {
101-
"file": "latest-linux.yml",
82+
"file": "latest-mac.yml",
10283
"fileContent": Object {
10384
"files": Array [
10485
Object {
105-
"blockMapSize": "@blockMapSize",
10686
"sha512": "@sha512",
107-
"size": "@size",
108-
"url": "TestApp-1.1.0-x86_64.AppImage",
87+
"url": "TestApp-1.1.0-mac.zip",
10988
},
11089
],
111-
"path": "TestApp-1.1.0-x86_64.AppImage",
90+
"path": "TestApp-1.1.0-mac.zip",
11291
"releaseDate": "@releaseDate",
11392
"sha512": "@sha512",
11493
"version": "1.1.0",
11594
},
11695
},
11796
Object {
118-
"file": "latest-linux.yml",
97+
"file": "latest-mac.yml",
11998
"fileContent": Object {
12099
"files": Array [
121100
Object {
122-
"blockMapSize": "@blockMapSize",
123101
"sha512": "@sha512",
124-
"size": "@size",
125-
"url": "TestApp-1.1.0-x86_64.AppImage",
102+
"url": "TestApp-1.1.0-mac.zip",
126103
},
127104
],
128-
"path": "TestApp-1.1.0-x86_64.AppImage",
105+
"path": "Test App ßW-1.1.0-mac.zip",
129106
"releaseDate": "@releaseDate",
130107
"sha512": "@sha512",
131108
"version": "1.1.0",
132109
},
133110
},
111+
Object {
112+
"arch": "x64",
113+
"file": "Test App ßW-1.1.0-mac.zip",
114+
"safeArtifactName": "TestApp-1.1.0-mac.zip",
115+
},
134116
],
135117
}
136118
`;

test/src/PublishManagerTest.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import { assertThat } from "./helpers/fileAssert"
44
import { app, checkDirContents } from "./helpers/packTester"
55

66
test.ifDevOrLinuxCi("generic, github and spaces", app({
7-
targets: Platform.LINUX.createTarget(),
7+
targets: Platform.MAC.createTarget("zip"),
88
config: {
99
generateUpdatesFilesForAllChannels: true,
10+
mac: {
11+
electronUpdaterCompatibility: ">=2.16",
12+
},
1013
publish: [
1114
{
1215
provider: "generic",

test/src/mac/macArchiveTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { app, copyTestAsset, createMacTargetTest, getFixtureDir, parseFileList }
1010

1111
test.ifMac.ifAll("invalid target", () => assertThat(createMacTargetTest(["ttt" as any])()).throws())
1212

13-
test.ifNotWindows("only zip", createMacTargetTest(["zip"]))
13+
test.ifNotWindows.ifAll("only zip", createMacTargetTest(["zip"]))
1414

15-
test.ifNotWindows("tar.gz", createMacTargetTest(["tar.gz"]))
15+
test.ifNotWindows.ifAll("tar.gz", createMacTargetTest(["tar.gz"]))
1616

1717
const it = process.env.CSC_KEY_PASSWORD == null ? test.skip : test.ifMac
1818

test/src/mac/macPackagerTest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import BluebirdPromise from "bluebird-lst"
21
import { copyOrLinkFile } from "builder-util/out/fs"
32
import { createTargets, DIR_TARGET, Platform } from "electron-builder"
43
import { readJson } from "fs-extra-p"
54
import * as path from "path"
65
import { assertThat } from "../helpers/fileAssert"
76
import { app, appThrows, assertPack, convertUpdateInfo, platform } from "../helpers/packTester"
87

9-
test.ifMac("two-package", () => assertPack("test-app", {
8+
test.ifMac.ifAll("two-package", () => assertPack("test-app", {
109
targets: createTargets([Platform.MAC], null, "all"),
1110
config: {
1211
extraMetadata: {
@@ -52,15 +51,15 @@ test.ifMac("one-package", app({
5251
ext: "bar",
5352
name: "Bar",
5453
role: "Shell",
55-
// If I specify `fileAssociations.icon` as `build/lhtmldoc.icns` will it know to use `build/lhtmldoc.ico` for Windows?
54+
// If I specify `fileAssociations.icon` as `build/foo.icns` will it know to use `build/foo.ico` for Windows?
5655
icon: "someFoo.ico"
5756
},
5857
]
5958
}
6059
}
6160
}, {
6261
signed: true,
63-
projectDirCreated: projectDir => BluebirdPromise.all([
62+
projectDirCreated: projectDir => Promise.all([
6463
copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "foo.icns")),
6564
copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "someFoo.icns")),
6665
]),

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999
version "1.3.29"
100100
resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.29.tgz#1325e981e047d40d13ce0359b821475b97741d2f"
101101

102-
"@types/jest@^22.1.0":
103-
version "22.1.0"
104-
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-22.1.0.tgz#c1de03bbac66fac4cc741f7a69cb73bc01a1707c"
102+
"@types/jest@^22.1.1":
103+
version "22.1.1"
104+
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-22.1.1.tgz#231d7c60ed130200af9e96c82469ed25b59a7ea2"
105105

106106
"@types/js-yaml@^3.10.1":
107107
version "3.10.1"
@@ -135,9 +135,9 @@
135135
dependencies:
136136
"@types/node" "*"
137137

138-
"@types/semver@^5.4.0":
139-
version "5.4.0"
140-
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.4.0.tgz#f3658535af7f1f502acd6da7daf405ffeb1f7ee4"
138+
"@types/semver@^5.5.0":
139+
version "5.5.0"
140+
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
141141

142142
"@types/source-map-support@^0.4.0":
143143
version "0.4.0"

0 commit comments

Comments
 (0)