From 831186f7c2fc9a26a75878e0a97cbf9ad5e2b653 Mon Sep 17 00:00:00 2001 From: develar Date: Sat, 15 Apr 2017 10:20:37 +0200 Subject: [PATCH] feat: automatically set channel to version prerelease component BREAKING CHANGE: if app version is `0.12.1-alpha.1`, file `alpha.yml` will be generated instead of `latest.yml` Close #1182 --- package.json | 4 +- .../src/publishOptions.ts | 4 +- packages/electron-builder/package.json | 4 +- packages/electron-builder/src/metadata.ts | 6 +++ .../src/publish/PublishManager.ts | 22 +++++++++-- packages/electron-builder/src/targets/nsis.ts | 7 ++-- .../electron-publisher-s3/src/s3Publisher.ts | 6 ++- .../fixtures/app-executable-deps/package.json | 2 +- test/fixtures/test-app-one/package.json | 2 +- test/fixtures/test-app/package.json | 2 +- test/out/__snapshots__/ExtraBuildTest.js.snap | 24 +++++++++++- test/out/__snapshots__/filesTest.js.snap | 37 +++++++++++++++++++ test/out/linux/__snapshots__/debTest.js.snap | 9 +++-- .../mac/__snapshots__/macArchiveTest.js.snap | 2 +- .../__snapshots__/squirrelWindowsTest.js.snap | 31 ++++++++++++++++ test/src/ExtraBuildTest.ts | 22 ++++++++++- test/src/filesTest.ts | 12 ------ test/src/helpers/config.ts | 2 +- test/src/helpers/expectedContents.ts | 28 -------------- test/src/helpers/packTester.ts | 28 +------------- test/src/mac/macArchiveTest.ts | 2 +- yarn.lock | 22 +++++------ 22 files changed, 174 insertions(+), 104 deletions(-) delete mode 100644 test/src/helpers/expectedContents.ts diff --git a/package.json b/package.json index 5b603663ea5..bdcd49bc54a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "electron-is-dev": "^0.1.2", "electron-osx-sign": "0.4.4", "fs-extra-p": "^4.1.0", - "hosted-git-info": "^2.4.1", + "hosted-git-info": "^2.4.2", "ini": "^1.3.4", "is-ci": "^1.0.10", "isbinaryfile": "^3.0.2", @@ -60,7 +60,7 @@ "tunnel-agent": "^0.6.0", "update-notifier": "^2.1.0", "uuid-1345": "^0.99.6", - "yargs": "^7.0.2" + "yargs": "^7.1.0" }, "devDependencies": { "@develar/typescript-json-schema": "0.11.0", diff --git a/packages/electron-builder-http/src/publishOptions.ts b/packages/electron-builder-http/src/publishOptions.ts index 19c8905fd7c..f5f390be9d4 100644 --- a/packages/electron-builder-http/src/publishOptions.ts +++ b/packages/electron-builder-http/src/publishOptions.ts @@ -22,8 +22,6 @@ export interface PublishConfiguration { * The owner. */ readonly owner?: string | null - - readonly token?: string | null } /** @@ -172,6 +170,8 @@ export interface BintrayOptions extends PublishConfiguration { * The Bintray user account. Used in cases where the owner is an organization. */ readonly user?: string | null + + readonly token?: string | null } export interface VersionInfo { diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json index 98ea3e7717b..a4e732ff21b 100644 --- a/packages/electron-builder/package.json +++ b/packages/electron-builder/package.json @@ -58,7 +58,7 @@ "electron-osx-sign": "0.4.4", "electron-publish": "0.0.0-semantic-release", "fs-extra-p": "^4.1.0", - "hosted-git-info": "^2.4.1", + "hosted-git-info": "^2.4.2", "is-ci": "^1.0.10", "isbinaryfile": "^3.0.2", "js-yaml": "^3.8.3", @@ -71,7 +71,7 @@ "semver": "^5.3.0", "update-notifier": "^2.1.0", "uuid-1345": "^0.99.6", - "yargs": "^7.0.2" + "yargs": "^7.1.0" }, "typings": "./out/electron-builder.d.ts", "publishConfig": { diff --git a/packages/electron-builder/src/metadata.ts b/packages/electron-builder/src/metadata.ts index 1d581465c68..ec211408d43 100644 --- a/packages/electron-builder/src/metadata.ts +++ b/packages/electron-builder/src/metadata.ts @@ -201,6 +201,12 @@ export interface Config extends PlatformSpecificBuildOptions { * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified. */ readonly electronCompile?: boolean + + /** + * Whether to infer update channel from application version prerelease components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`. + * @default true + */ + readonly detectUpdateChannel?: boolean readonly mac?: MacOptions | null readonly mas?: MasBuildOptions | null diff --git a/packages/electron-builder/src/publish/PublishManager.ts b/packages/electron-builder/src/publish/PublishManager.ts index 22860563790..e213cdf926f 100644 --- a/packages/electron-builder/src/publish/PublishManager.ts +++ b/packages/electron-builder/src/publish/PublishManager.ts @@ -14,6 +14,7 @@ import { createReadStream, ensureDir, outputJson, writeFile } from "fs-extra-p" import isCi from "is-ci" import { safeDump } from "js-yaml" import * as path from "path" +import { prerelease } from "semver" import * as url from "url" import { Packager } from "../packager" import { ArtifactCreated, BuildInfo } from "../packagerApi" @@ -441,18 +442,31 @@ function expandPublishConfig(options: any, packager: PlatformPackager, arch async function getResolvedPublishConfig(packager: PlatformPackager, options: PublishConfiguration, arch: Arch | null, errorIfCannot: boolean = true): Promise { options = Object.assign(Object.create(null), options) expandPublishConfig(options, packager, arch) - + + let channelFromAppVersion: string | null = null + if ((options).channel == null && packager.config.detectUpdateChannel !== false) { + const prereleaseInfo = prerelease(packager.appInfo.version) + if (prereleaseInfo != null && prereleaseInfo.length > 0) { + channelFromAppVersion = prereleaseInfo[0] + } + } + const provider = options.provider if (provider === "generic") { - if ((options).url == null) { + const o = options + if (o.url == null) { throw new Error(`Please specify "url" for "generic" update server`) } + + if (channelFromAppVersion != null) { + (o).channel = channelFromAppVersion + } return options } const providerClass = requireProviderClass(options.provider) if (providerClass != null && providerClass.checkAndResolveOptions != null) { - await providerClass.checkAndResolveOptions(options) + await providerClass.checkAndResolveOptions(options, channelFromAppVersion) return options } @@ -505,7 +519,7 @@ async function getResolvedPublishConfig(packager: PlatformPackager, options } if (isGithub) { - if (options.token != null && !(options).private) { + if ((options).token != null && !(options).private) { warn('"token" specified in the github publish options. It should be used only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL).') } return Object.assign({owner, repo: project}, options) diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts index 773e149fcf9..9f7b5d14aaa 100644 --- a/packages/electron-builder/src/targets/nsis.ts +++ b/packages/electron-builder/src/targets/nsis.ts @@ -397,7 +397,8 @@ export class NsisTarget extends Target { const command = path.join(nsisPath, process.platform === "darwin" ? "mac" : (process.platform === "win32" ? "Bin" : "linux"), process.platform === "win32" ? "makensis.exe" : "makensis") const childProcess = doSpawn(command, args, { // we use NSIS_CONFIG_CONST_DATA_PATH=no to build makensis on Linux, but in any case it doesn't use stubs as MacOS/Windows version, so, we explicitly set NSISDIR - env: Object.assign({}, process.env, {NSISDIR: nsisPath}), + // set LC_CTYPE to avoid crash https://github.com/electron-userland/electron-builder/issues/503 Even "en_DE.UTF-8" leads to error. + env: Object.assign({}, process.env, {NSISDIR: nsisPath, LC_CTYPE: "en_US.UTF-8"}), cwd: this.nsisTemplatesDir, }, true) handleProcess("close", childProcess, command, resolve, error => { @@ -416,10 +417,10 @@ export class NsisTarget extends Target { private async computeFinalScript(originalScript: string, isInstaller: boolean) { const packager = this.packager - let scriptHeader = `!addincludedir "${path.win32.join(__dirname, "..", "..", "templates", "nsis", "include")}"\n` + let scriptHeader = `!addincludedir "${path.join(__dirname, "..", "..", "templates", "nsis", "include")}"\n` const addCustomMessageFileInclude = async (input: string) => { - return "!include " + await this.writeCustomLangFile(computeCustomMessageTranslations(safeLoad(await readFile(path.join(this.nsisTemplatesDir, input), "utf-8"))).join("\n")) + "\n" + return '!include "' + await this.writeCustomLangFile(computeCustomMessageTranslations(safeLoad(await readFile(path.join(this.nsisTemplatesDir, input), "utf-8"))).join("\n")) + '"\n' } const tasks: Array<() => Promise> = [ diff --git a/packages/electron-publisher-s3/src/s3Publisher.ts b/packages/electron-publisher-s3/src/s3Publisher.ts index ae139214737..39d93ad9231 100644 --- a/packages/electron-publisher-s3/src/s3Publisher.ts +++ b/packages/electron-publisher-s3/src/s3Publisher.ts @@ -16,7 +16,7 @@ export default class S3Publisher extends Publisher { debug(`Creating S3 Publisher — bucket: ${info.bucket}`) } - static async checkAndResolveOptions(options: S3Options) { + static async checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null) { const bucket = options.bucket if (bucket == null) { throw new Error(`Please specify "bucket" for "s3" update server`) @@ -27,6 +27,10 @@ export default class S3Publisher extends Publisher { const s3 = new S3({signatureVersion: "v4"}); (options).region = (await s3.getBucketLocation({Bucket: bucket}).promise()).LocationConstraint } + + if (options.channel == null && channelFromAppVersion != null) { + (options).channel = channelFromAppVersion + } } // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html diff --git a/test/fixtures/app-executable-deps/package.json b/test/fixtures/app-executable-deps/package.json index e3f53bb5387..ef5ce65a6dc 100644 --- a/test/fixtures/app-executable-deps/package.json +++ b/test/fixtures/app-executable-deps/package.json @@ -1,6 +1,6 @@ { "build": { - "electronVersion": "1.6.3", + "electronVersion": "1.6.6", "category": "public.app-category.business" } } diff --git a/test/fixtures/test-app-one/package.json b/test/fixtures/test-app-one/package.json index 169703129a6..5da953936eb 100644 --- a/test/fixtures/test-app-one/package.json +++ b/test/fixtures/test-app-one/package.json @@ -8,7 +8,7 @@ "author": "Foo Bar ", "license": "MIT", "build": { - "electronVersion": "1.6.3", + "electronVersion": "1.6.6", "appId": "org.electron-builder.testApp", "compression": "store", "npmRebuild": false, diff --git a/test/fixtures/test-app/package.json b/test/fixtures/test-app/package.json index ab507b32313..6293db1fabb 100644 --- a/test/fixtures/test-app/package.json +++ b/test/fixtures/test-app/package.json @@ -1,7 +1,7 @@ { "private": true, "build": { - "electronVersion": "1.6.3", + "electronVersion": "1.6.6", "appId": "org.electron-builder.testApp", "compression": "store", "npmRebuild": false, diff --git a/test/out/__snapshots__/ExtraBuildTest.js.snap b/test/out/__snapshots__/ExtraBuildTest.js.snap index bfbe3165116..8bb98eac2ae 100644 --- a/test/out/__snapshots__/ExtraBuildTest.js.snap +++ b/test/out/__snapshots__/ExtraBuildTest.js.snap @@ -32,15 +32,35 @@ Object { exports[`override targets in the config - only arch 1`] = ` Object { "win": Array [ + Object { + "arch": null, + "file": "beta.yml", + }, Object { "arch": 0, - "file": "Test App ßW Setup 1.1.0.exe", - "safeArtifactName": "TestApp-Setup-1.1.0.exe", + "file": "Test App ßW Setup 1.0.0-beta.1.exe", + "safeArtifactName": "TestApp-Setup-1.0.0-beta.1.exe", }, ], } `; +exports[`override targets in the config - only arch 2`] = ` +Object { + "channel": "beta", + "provider": "generic", + "url": "https://develar.s3.amazonaws.com/test", +} +`; + +exports[`override targets in the config - only arch 3`] = ` +Object { + "githubArtifactName": "TestApp-Setup-1.0.0-beta.1.exe", + "path": "Test App ßW Setup 1.0.0-beta.1.exe", + "version": "1.0.0-beta.1", +} +`; + exports[`override targets in the config 1`] = ` Object { "linux": Array [], diff --git a/test/out/__snapshots__/filesTest.js.snap b/test/out/__snapshots__/filesTest.js.snap index 643731b6ba1..4da63997b93 100644 --- a/test/out/__snapshots__/filesTest.js.snap +++ b/test/out/__snapshots__/filesTest.js.snap @@ -34,6 +34,43 @@ Object { } `; +exports[`extraResources on Linux and Windows 3`] = ` +Array [ + "lib/net45/blink_image_resources_200_percent.pak", + "lib/net45/content_resources_200_percent.pak", + "lib/net45/content_shell.pak", + "lib/net45/d3dcompiler_47.dll", + "lib/net45/ffmpeg.dll", + "lib/net45/icudtl.dat", + "lib/net45/libEGL.dll", + "lib/net45/libGLESv2.dll", + "lib/net45/LICENSE.electron.txt", + "lib/net45/LICENSES.chromium.html", + "lib/net45/natives_blob.bin", + "lib/net45/node.dll", + "lib/net45/pdf_viewer_resources.pak", + "lib/net45/snapshot_blob.bin", + "lib/net45/Test%20App%20%C3%9FW.exe", + "lib/net45/Test%20App%20%C3%9FW_ExecutionStub.exe", + "lib/net45/ui_resources_200_percent.pak", + "lib/net45/Update.exe", + "lib/net45/views_resources_200_percent.pak", + "lib/net45/xinput1_3.dll", + "lib/net45/locales/en-US.pak", + "lib/net45/resources/app.asar", + "lib/net45/resources/electron.asar", + "lib/net45/resources/platformSpecificR", + "lib/net45/resources/bar/hello.txt", + "lib/net45/resources/bar/x64.txt", + "lib/net45/resources/dir-relative/f.txt", + "lib/net45/resources/foo/nameWithoutDot", + "lib/net45/resources/win/x64.txt", + "TestApp.nuspec", + "[Content_Types].xml", + "_rels/.rels", +] +`; + exports[`extraResources on macOS 1`] = ` Object { "mac": Array [], diff --git a/test/out/linux/__snapshots__/debTest.js.snap b/test/out/linux/__snapshots__/debTest.js.snap index 94c929f2f64..b9b0de9e5a1 100644 --- a/test/out/linux/__snapshots__/debTest.js.snap +++ b/test/out/linux/__snapshots__/debTest.js.snap @@ -26,6 +26,7 @@ Array [ "/opt/Test App ßW/LICENSE.electron.txt", "/opt/Test App ßW/LICENSES.chromium.html", "/opt/Test App ßW/natives_blob.bin", + "/opt/Test App ßW/pdf_viewer_resources.pak", "/opt/Test App ßW/snapshot_blob.bin", "/opt/Test App ßW/testapp", "/opt/Test App ßW/ui_resources_200_percent.pak", @@ -83,7 +84,7 @@ Object { "Package": "testapp", "Priority": "extra", "Section": "devel", - "Size": "89541", + "Size": "91139", "Vendor": "Foo Bar ", } `; @@ -127,6 +128,7 @@ Array [ "/opt/Test App ßW/LICENSE.electron.txt", "/opt/Test App ßW/LICENSES.chromium.html", "/opt/Test App ßW/natives_blob.bin", + "/opt/Test App ßW/pdf_viewer_resources.pak", "/opt/Test App ßW/snapshot_blob.bin", "/opt/Test App ßW/ui_resources_200_percent.pak", "/opt/Test App ßW/views_resources_200_percent.pak", @@ -183,7 +185,7 @@ Object { "Package": "testapp", "Priority": "extra", "Section": "devel", - "Size": "123301", + "Size": "124968", "Vendor": "Foo Bar ", } `; @@ -214,6 +216,7 @@ Array [ "/opt/Test App ßW/LICENSE.electron.txt", "/opt/Test App ßW/LICENSES.chromium.html", "/opt/Test App ßW/natives_blob.bin", + "/opt/Test App ßW/pdf_viewer_resources.pak", "/opt/Test App ßW/snapshot_blob.bin", "/opt/Test App ßW/testapp", "/opt/Test App ßW/ui_resources_200_percent.pak", @@ -271,7 +274,7 @@ Object { "Package": "testapp", "Priority": "extra", "Section": "devel", - "Size": "123301", + "Size": "124968", "Vendor": "Foo Bar ", } `; diff --git a/test/out/mac/__snapshots__/macArchiveTest.js.snap b/test/out/mac/__snapshots__/macArchiveTest.js.snap index 52f8376586e..b8c7d3244f6 100644 --- a/test/out/mac/__snapshots__/macArchiveTest.js.snap +++ b/test/out/mac/__snapshots__/macArchiveTest.js.snap @@ -235,6 +235,7 @@ Array [ "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/natives_blob.bin", "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/nb.lproj", "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/nl.lproj", + "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/pdf_viewer_resources.pak", "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/pl.lproj", "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/pt_BR.lproj", "Test App ßW.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources/pt_PT.lproj", @@ -433,7 +434,6 @@ Object { Object { "_": "#org.electron-builder.testApp.pkg", "id": "org.electron-builder.testApp", - "installKBytes": "109832", "onConclusion": "none", "version": "1.1.0", }, diff --git a/test/out/windows/__snapshots__/squirrelWindowsTest.js.snap b/test/out/windows/__snapshots__/squirrelWindowsTest.js.snap index 1cf86ae366c..6dd98b39aa3 100644 --- a/test/out/windows/__snapshots__/squirrelWindowsTest.js.snap +++ b/test/out/windows/__snapshots__/squirrelWindowsTest.js.snap @@ -24,3 +24,34 @@ Object { ], } `; + +exports[`Squirrel.Windows 2`] = ` +Array [ + "lib/net45/blink_image_resources_200_percent.pak", + "lib/net45/content_resources_200_percent.pak", + "lib/net45/content_shell.pak", + "lib/net45/d3dcompiler_47.dll", + "lib/net45/ffmpeg.dll", + "lib/net45/icudtl.dat", + "lib/net45/libEGL.dll", + "lib/net45/libGLESv2.dll", + "lib/net45/LICENSE.electron.txt", + "lib/net45/LICENSES.chromium.html", + "lib/net45/natives_blob.bin", + "lib/net45/node.dll", + "lib/net45/pdf_viewer_resources.pak", + "lib/net45/snapshot_blob.bin", + "lib/net45/Test%20App%20%C3%9FW.exe", + "lib/net45/Test%20App%20%C3%9FW_ExecutionStub.exe", + "lib/net45/ui_resources_200_percent.pak", + "lib/net45/Update.exe", + "lib/net45/views_resources_200_percent.pak", + "lib/net45/xinput1_3.dll", + "lib/net45/locales/en-US.pak", + "lib/net45/resources/app.asar", + "lib/net45/resources/electron.asar", + "TestApp.nuspec", + "[Content_Types].xml", + "_rels/.rels", +] +`; diff --git a/test/src/ExtraBuildTest.ts b/test/src/ExtraBuildTest.ts index bd05089543f..fcd6d746351 100644 --- a/test/src/ExtraBuildTest.ts +++ b/test/src/ExtraBuildTest.ts @@ -1,9 +1,11 @@ import { Arch, DIR_TARGET, Platform } from "electron-builder" import { build } from "electron-builder/out/builder" -import { move } from "fs-extra-p" +import { move, readFile } from "fs-extra-p" +import { safeLoad } from "js-yaml" import * as path from "path" import { assertThat } from "./helpers/fileAssert" import { app, appThrows } from "./helpers/packTester" +import { expectUpdateMetadata } from "./helpers/winHelper" function createBuildResourcesTest(platform: Platform) { return app({ @@ -77,9 +79,12 @@ test.ifAll.ifDevOrLinuxCi("override targets in the config", app({ } })) - +// test https://github.com/electron-userland/electron-builder/issues/1182 also test.ifAll.ifDevOrWinCi("override targets in the config - only arch", app({ targets: Platform.WINDOWS.createTarget(null, Arch.ia32), + appMetadata: { + version: "1.0.0-beta.1", + }, config: { // https://github.com/electron-userland/electron-builder/issues/1348 win: { @@ -87,10 +92,23 @@ test.ifAll.ifDevOrWinCi("override targets in the config - only arch", app({ "nsis", ], }, + publish: { + provider: "generic", + url: "https://develar.s3.amazonaws.com/test", + }, }, }, { packed: async (context) => { await assertThat(path.join(context.projectDir, "dist", "win-unpacked")).doesNotExist() + await assertThat(path.join(context.projectDir, "dist", "latest.yml")).doesNotExist() + await expectUpdateMetadata(context, Arch.ia32) + + const updateInfo = safeLoad(await readFile(path.join(context.outDir, "beta.yml"), "utf-8")) + expect(updateInfo.sha2).not.toEqual("") + expect(updateInfo.releaseDate).not.toEqual("") + delete updateInfo.sha2 + delete updateInfo.releaseDate + expect(updateInfo).toMatchSnapshot() }, })) diff --git a/test/src/filesTest.ts b/test/src/filesTest.ts index 07f6cd65e5c..f4ae0594099 100644 --- a/test/src/filesTest.ts +++ b/test/src/filesTest.ts @@ -4,9 +4,7 @@ import { copyDir } from "electron-builder-util/out/fs" import { TmpDir } from "electron-builder-util/out/tmp" import { outputFile, readFile, stat, symlink } from "fs-extra-p" import * as path from "path" -import pathSorter from "path-sort" import Mode, { Permissions } from "stat-mode" -import { expectedWinContents } from "./helpers/expectedContents" import { assertThat } from "./helpers/fileAssert" import { app, appThrows, assertPack } from "./helpers/packTester" @@ -74,8 +72,6 @@ test.ifDevOrLinuxCi("map resources", app({ async function doExtraResourcesTest(platform: Platform) { const osName = platform.buildConfigurationKey - const winDirPrefix = "lib/net45/resources/" - //noinspection SpellCheckingInspection await assertPack("test-app-one", { // to check NuGet package @@ -127,14 +123,6 @@ async function doExtraResourcesTest(platform: Platform) { assertThat(path.join(resourcesDir, "ignoreMe.txt")).doesNotExist(), ]) }, - expectedContents: platform === Platform.WINDOWS ? pathSorter(expectedWinContents.concat( - winDirPrefix + "bar/hello.txt", - winDirPrefix + "dir-relative/f.txt", - winDirPrefix + "bar/x64.txt", - winDirPrefix + "foo/nameWithoutDot", - winDirPrefix + "platformSpecificR", - winDirPrefix + "win/x64.txt" - )) : null, }) } diff --git a/test/src/helpers/config.ts b/test/src/helpers/config.ts index 7b645ff7ea1..9898c48f428 100644 --- a/test/src/helpers/config.ts +++ b/test/src/helpers/config.ts @@ -11,4 +11,4 @@ docker: Error response from daemon: Mounts denied: o Docker. */ const baseDir = process.env.ELECTRON_BUILDER_TEST_DIR || (process.platform === "darwin" && !require("is-ci") ? "/tmp" : tmpdir()) export const TEST_DIR = path.join(baseDir, `et-${createHash("md5").update(__dirname).digest("hex")}`) -export const ELECTRON_VERSION = "1.6.3" \ No newline at end of file +export const ELECTRON_VERSION = "1.6.6" \ No newline at end of file diff --git a/test/src/helpers/expectedContents.ts b/test/src/helpers/expectedContents.ts deleted file mode 100644 index 0da3e9c5ab7..00000000000 --- a/test/src/helpers/expectedContents.ts +++ /dev/null @@ -1,28 +0,0 @@ -//noinspection SpellCheckingInspection -export const expectedWinContents = [ - "lib/net45/blink_image_resources_200_percent.pak", - "lib/net45/content_resources_200_percent.pak", - "lib/net45/content_shell.pak", - "lib/net45/d3dcompiler_47.dll", - "lib/net45/ffmpeg.dll", - "lib/net45/icudtl.dat", - "lib/net45/libEGL.dll", - "lib/net45/libGLESv2.dll", - "lib/net45/LICENSE.electron.txt", - "lib/net45/LICENSES.chromium.html", - "lib/net45/natives_blob.bin", - "lib/net45/node.dll", - "lib/net45/snapshot_blob.bin", - "lib/net45/TestApp.exe", - "lib/net45/TestApp_ExecutionStub.exe", - "lib/net45/ui_resources_200_percent.pak", - "lib/net45/Update.exe", - "lib/net45/views_resources_200_percent.pak", - "lib/net45/xinput1_3.dll", - "lib/net45/locales/en-US.pak", - "lib/net45/resources/app.asar", - "lib/net45/resources/electron.asar", - "TestApp.nuspec", - "[Content_Types].xml", - "_rels/.rels" -] \ No newline at end of file diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index f8f4565b087..f4a141ba669 100644 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -13,7 +13,6 @@ import pathSorter from "path-sort" import { parse as parsePlist } from "plist" import { CSC_LINK } from "./codeSignData" import { TEST_DIR } from "./config" -import { expectedWinContents } from "./expectedContents" import { assertThat } from "./fileAssert" if (process.env.TRAVIS !== "true") { @@ -25,7 +24,6 @@ const OUT_DIR_NAME = "dist" interface AssertPackOptions { readonly projectDirCreated?: (projectDir: string) => Promise readonly packed?: (context: PackedContext) => Promise - readonly expectedContents?: Array | boolean readonly expectedArtifacts?: Array readonly checkMacApp?: (appDir: string, info: any) => Promise @@ -298,31 +296,9 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp const files = pathSorter(fileDescriptors.map(it => it.path.replace(/\\/g, "/")).filter(it => (!it.startsWith("lib/net45/locales/") || it === "lib/net45/locales/en-US.pak") && !it.endsWith(".psmdcp") && !it.endsWith("app-update.yml"))) // console.log(JSON.stringify(files, null, 2)) - const expectedContents = checkOptions == null || checkOptions.expectedContents == null ? expectedWinContents : checkOptions.expectedContents - if (expectedContents === true) { - expect(files).toMatchSnapshot() - } - else { - expect(files).toEqual(pathSorter((>expectedContents).map(it => { - if (it === "lib/net45/TestApp.exe") { - if (appInfo.productFilename === "Test App ßW") { - return `lib/net45/Test%20App%20%C3%9FW.exe` - } - return `lib/net45/${encodeURI(appInfo.productFilename).replace(/%5B/g, "[").replace(/%5D/g, "]")}.exe` - } - else if (it === "lib/net45/TestApp_ExecutionStub.exe") { - if (appInfo.productFilename === "Test App ßW") { - return `lib/net45/Test%20App%20%C3%9FW_ExecutionStub.exe` - } - return `lib/net45/${encodeURI(appInfo.productFilename).replace(/%5B/g, "[").replace(/%5D/g, "]")}_ExecutionStub.exe` - } - else { - return it - } - }))) - } + expect(files).toMatchSnapshot() - if (checkOptions == null || checkOptions.expectedContents == null) { + if (checkOptions == null) { await unZipper.extractFile(fileDescriptors.filter(it => it.path === "TestApp.nuspec")[0], { path: path.dirname(packageFile), }) diff --git a/test/src/mac/macArchiveTest.ts b/test/src/mac/macArchiveTest.ts index bc70a5f0797..852468e49e1 100644 --- a/test/src/mac/macArchiveTest.ts +++ b/test/src/mac/macArchiveTest.ts @@ -39,8 +39,8 @@ test.ifMac("pkg scripts", app({ mergeAttrs: true, }) delete info["pkg-ref"][0]["bundle-version"].bundle.CFBundleVersion + delete info["pkg-ref"][1].installKBytes delete info.product.version - delete info.installKBytes expect(info).toMatchSnapshot() const scriptDir = path.join(unpackedDir, "org.electron-builder.testApp.pkg", "Scripts") diff --git a/yarn.lock b/yarn.lock index d3845c640c6..3e601e2e6db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -215,8 +215,8 @@ arr-diff@^2.0.0: arr-flatten "^1.0.1" arr-flatten@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.1.tgz#e5ffe54d45e19f32f216e91eb99c8ce892bb604b" + version "1.0.2" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.2.tgz#1ec1e63439c54f67d6f72bb4299c3d4f73b2d996" array-back@^1.0.2, array-back@^1.0.3, array-back@^1.0.4: version "1.0.4" @@ -1471,9 +1471,9 @@ home-path@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.5.tgz#788b29815b12d53bacf575648476e6f9041d133f" -hosted-git-info@^2.1.4, hosted-git-info@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.4.1.tgz#4b0445e41c004a8bd1337773a4ff790ca40318c8" +hosted-git-info@^2.1.4, hosted-git-info@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.4.2.tgz#0076b9f46a270506ddbaaea56496897460612a67" html-encoding-sniffer@^1.0.1: version "1.0.1" @@ -2938,8 +2938,8 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" sshpk@^1.7.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.11.0.tgz#2d8d5ebb4a6fab28ffba37fa62a90f4a3ea59d77" + version "1.13.0" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.0.tgz#ff2a3e4fd04497555fed97b39a0fd82fafb3a33c" dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -3234,7 +3234,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -typescript@^2.2.2: +typescript@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.0.tgz#2e63e09284392bc8158a2444c33e2093795c0418" @@ -3558,9 +3558,9 @@ yargs@^6.0.0, yargs@^6.3.0: y18n "^3.2.1" yargs-parser "^4.2.0" -yargs@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.0.2.tgz#115b97df1321823e8b8648e8968c782521221f67" +yargs@^7.0.2, yargs@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" dependencies: camelcase "^3.0.0" cliui "^3.2.0"