Skip to content

Commit

Permalink
fix(mac): generate latest-mac.yml for zip target
Browse files Browse the repository at this point in the history
Close #2313
  • Loading branch information
develar committed Jan 30, 2018
1 parent e35846a commit f545d1e
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 66 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@
"@types/ejs": "^2.5.0",
"@types/electron-is-dev": "^0.3.0",
"@types/ini": "^1.3.29",
"@types/jest": "^22.1.0",
"@types/jest": "^22.1.1",
"@types/js-yaml": "^3.10.1",
"@types/lodash.isequal": "^4.5.2",
"@types/node-emoji": "^1.8.0",
"@types/sanitize-filename": "^1.1.28",
"@types/sax": "^1.0.0",
"@types/semver": "^5.4.0",
"@types/semver": "^5.5.0",
"@types/source-map-support": "^0.4.0",
"@types/stat-mode": "^0.2.0",
"babel-preset-ts-node6-bluebird": "^1.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
break

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

case "pkg":
Expand Down
9 changes: 5 additions & 4 deletions packages/electron-builder-lib/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ export class PublishManager implements PublishContext {
}
}

if (event.isWriteUpdateInfo && target != null && eventFile != null && !this.cancellationToken.cancelled) {
if (packager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target)) {
this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))
}
if (event.isWriteUpdateInfo && target != null && eventFile != null &&
!this.cancellationToken.cancelled &&
(packager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target))) {
this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))
}
}

Expand All @@ -169,6 +169,7 @@ export class PublishManager implements PublishContext {
return publisher
}

// noinspection JSUnusedGlobalSymbols
cancelTasks() {
this.taskManager.cancelTasks()
this.nameToPublisher.clear()
Expand Down
2 changes: 2 additions & 0 deletions packages/electron-publish/src/gitHubPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ export class GitHubPublisher extends HttpPublisher {

if (isEnvTrue(process.env.EP_DRAFT)) {
this.releaseType = "draft"
log.info({reason: "env EP_DRAFT is set to true"}, "GitHub provider release type is set to draft")
}
else if (isEnvTrue(process.env.EP_PRELEASE)) {
this.releaseType = "prerelease"
log.info({reason: "env EP_PRELEASE is set to true"}, "GitHub provider release type is set to prerelease")
}
else if (info.releaseType != null) {
this.releaseType = info.releaseType
Expand Down
72 changes: 27 additions & 45 deletions test/out/__snapshots__/PublishManagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,135 +2,117 @@

exports[`generic, github and spaces 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
},
},
"mac": Array [
Object {
"file": "alpha-linux.yml",
"file": "alpha-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "alpha-linux.yml",
"file": "alpha-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "beta-linux.yml",
"file": "beta-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "beta-linux.yml",
"file": "beta-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "latest-linux.yml",
"file": "latest-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "latest-linux.yml",
"file": "latest-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "TestApp-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"file": "latest-linux.yml",
"file": "latest-mac.yml",
"fileContent": Object {
"files": Array [
Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "TestApp-1.1.0-mac.zip",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW-1.1.0-mac.zip",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
},
},
Object {
"arch": "x64",
"file": "Test App ßW-1.1.0-mac.zip",
"safeArtifactName": "TestApp-1.1.0-mac.zip",
},
],
}
`;
Expand Down
5 changes: 4 additions & 1 deletion test/src/PublishManagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { assertThat } from "./helpers/fileAssert"
import { app, checkDirContents } from "./helpers/packTester"

test.ifDevOrLinuxCi("generic, github and spaces", app({
targets: Platform.LINUX.createTarget(),
targets: Platform.MAC.createTarget("zip"),
config: {
generateUpdatesFilesForAllChannels: true,
mac: {
electronUpdaterCompatibility: ">=2.16",
},
publish: [
{
provider: "generic",
Expand Down
4 changes: 2 additions & 2 deletions test/src/mac/macArchiveTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { app, copyTestAsset, createMacTargetTest, getFixtureDir, parseFileList }

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

test.ifNotWindows("only zip", createMacTargetTest(["zip"]))
test.ifNotWindows.ifAll("only zip", createMacTargetTest(["zip"]))

test.ifNotWindows("tar.gz", createMacTargetTest(["tar.gz"]))
test.ifNotWindows.ifAll("tar.gz", createMacTargetTest(["tar.gz"]))

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

Expand Down
7 changes: 3 additions & 4 deletions test/src/mac/macPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import BluebirdPromise from "bluebird-lst"
import { copyOrLinkFile } from "builder-util/out/fs"
import { createTargets, DIR_TARGET, Platform } from "electron-builder"
import { readJson } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "../helpers/fileAssert"
import { app, appThrows, assertPack, convertUpdateInfo, platform } from "../helpers/packTester"

test.ifMac("two-package", () => assertPack("test-app", {
test.ifMac.ifAll("two-package", () => assertPack("test-app", {
targets: createTargets([Platform.MAC], null, "all"),
config: {
extraMetadata: {
Expand Down Expand Up @@ -52,15 +51,15 @@ test.ifMac("one-package", app({
ext: "bar",
name: "Bar",
role: "Shell",
// If I specify `fileAssociations.icon` as `build/lhtmldoc.icns` will it know to use `build/lhtmldoc.ico` for Windows?
// If I specify `fileAssociations.icon` as `build/foo.icns` will it know to use `build/foo.ico` for Windows?
icon: "someFoo.ico"
},
]
}
}
}, {
signed: true,
projectDirCreated: projectDir => BluebirdPromise.all([
projectDirCreated: projectDir => Promise.all([
copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "foo.icns")),
copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "someFoo.icns")),
]),
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
version "1.3.29"
resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.29.tgz#1325e981e047d40d13ce0359b821475b97741d2f"

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

"@types/js-yaml@^3.10.1":
version "3.10.1"
Expand Down Expand Up @@ -135,9 +135,9 @@
dependencies:
"@types/node" "*"

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

"@types/source-map-support@^0.4.0":
version "0.4.0"
Expand Down

0 comments on commit f545d1e

Please sign in to comment.