diff --git a/package.json b/package.json index 9d8c37b7a2e..324fa4b74d8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/electron-builder-lib/src/macPackager.ts b/packages/electron-builder-lib/src/macPackager.ts index f8482fdfb94..8dc56819abb 100644 --- a/packages/electron-builder-lib/src/macPackager.ts +++ b/packages/electron-builder-lib/src/macPackager.ts @@ -64,8 +64,8 @@ export default class MacPackager extends PlatformPackager { 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": diff --git a/packages/electron-builder-lib/src/publish/PublishManager.ts b/packages/electron-builder-lib/src/publish/PublishManager.ts index b84e724e958..129e7ccba6f 100644 --- a/packages/electron-builder-lib/src/publish/PublishManager.ts +++ b/packages/electron-builder-lib/src/publish/PublishManager.ts @@ -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))) } } @@ -169,6 +169,7 @@ export class PublishManager implements PublishContext { return publisher } + // noinspection JSUnusedGlobalSymbols cancelTasks() { this.taskManager.cancelTasks() this.nameToPublisher.clear() diff --git a/packages/electron-publish/src/gitHubPublisher.ts b/packages/electron-publish/src/gitHubPublisher.ts index 31eeb036ef0..f3ec30e1831 100644 --- a/packages/electron-publish/src/gitHubPublisher.ts +++ b/packages/electron-publish/src/gitHubPublisher.ts @@ -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 diff --git a/test/out/__snapshots__/PublishManagerTest.js.snap b/test/out/__snapshots__/PublishManagerTest.js.snap index 3912f80ab4d..75c489a1620 100644 --- a/test/out/__snapshots__/PublishManagerTest.js.snap +++ b/test/out/__snapshots__/PublishManagerTest.js.snap @@ -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", + }, ], } `; diff --git a/test/src/PublishManagerTest.ts b/test/src/PublishManagerTest.ts index 54d4ad9c0c7..1be2631e7e4 100644 --- a/test/src/PublishManagerTest.ts +++ b/test/src/PublishManagerTest.ts @@ -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", diff --git a/test/src/mac/macArchiveTest.ts b/test/src/mac/macArchiveTest.ts index efb93198b18..db27e7e2781 100644 --- a/test/src/mac/macArchiveTest.ts +++ b/test/src/mac/macArchiveTest.ts @@ -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 diff --git a/test/src/mac/macPackagerTest.ts b/test/src/mac/macPackagerTest.ts index 5302939d24e..e54c0b5b099 100644 --- a/test/src/mac/macPackagerTest.ts +++ b/test/src/mac/macPackagerTest.ts @@ -1,4 +1,3 @@ -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" @@ -6,7 +5,7 @@ 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: { @@ -52,7 +51,7 @@ 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" }, ] @@ -60,7 +59,7 @@ test.ifMac("one-package", app({ } }, { 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")), ]), diff --git a/yarn.lock b/yarn.lock index 70521028c3a..d8a395e5d27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"