diff --git a/docs/programmaticUsage.js b/docs/programmaticUsage.js index d9dc1d2c19d..5714d093e9b 100644 --- a/docs/programmaticUsage.js +++ b/docs/programmaticUsage.js @@ -1,11 +1,11 @@ "use strict" const builder = require("electron-builder") +const Platform = builder.Platform // Promise is returned builder.build({ - platform: [builder.Platform.MAC], - "//": "platform, arch and other properties, see PackagerOptions in the node_modules/electron-builder/out/electron-builder.d.ts", + targets: Platform.MAC.createTarget(), config: { "//": "build options, see https://goo.gl/ZhRfla" } diff --git a/package.json b/package.json index 46dc8c9e47e..5b619550efd 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "source-map-support": "^0.4.11", "ts-babel": "^1.3.5", "tslint": "^4.4.2", - "typescript": "^2.1.5", + "typescript": "^2.2.0", "whitespace": "^2.1.0" }, "jest": { diff --git a/packages/electron-builder-http/src/httpExecutor.ts b/packages/electron-builder-http/src/httpExecutor.ts index c0b9fdadd95..9a63cea8401 100644 --- a/packages/electron-builder-http/src/httpExecutor.ts +++ b/packages/electron-builder-http/src/httpExecutor.ts @@ -121,7 +121,7 @@ export abstract class HttpExecutor { try { const contentType = response.headers["content-type"] const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes("json")) != null : contentType.includes("json")) - if (response.statusCode >= 400) { + if (response.statusCode != null && response.statusCode >= 400) { reject(new HttpError(response, isJson ? JSON.parse(data) : data)) } else { diff --git a/test/src/linux/linuxPackagerTest.ts b/test/src/linux/linuxPackagerTest.ts index cd85c43e3af..857076f44f8 100755 --- a/test/src/linux/linuxPackagerTest.ts +++ b/test/src/linux/linuxPackagerTest.ts @@ -1,7 +1,8 @@ import { modifyPackageJson, app, appThrows } from "../helpers/packTester" -import { remove, readFile } from "fs-extra-p" +import { remove, readFile, rename } from "fs-extra-p" import * as path from "path" -import { Platform } from "electron-builder" +import { Platform, build } from "electron-builder" +import { assertThat } from "../helpers/fileAssert" test.ifDevOrLinuxCi("AppImage", app({targets: Platform.LINUX.createTarget()})) @@ -9,8 +10,8 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt targets: Platform.LINUX.createTarget("appimage"), effectiveOptionComputed: async (it) => { const content = await readFile(it[1], "utf-8") - expect (content.includes("Foo=bar")).toBeTruthy() - expect (content.includes("Terminal=true")).toBeTruthy() + expect(content.includes("Foo=bar")).toBeTruthy() + expect(content.includes("Terminal=true")).toBeTruthy() return false }, config: { @@ -27,7 +28,21 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt })) test.ifNotWindows("icons from ICNS", app({targets: Platform.LINUX.createTarget()}, { - projectDirCreated: it => remove(path.join(it, "build", "icons")) + projectDirCreated: it => remove(path.join(it, "build", "icons")), + packed: async context => { + // test https://github.com/electron-userland/electron-builder/issues/1102 + const projectDir = context.getResources(Platform.LINUX) + + await rename(path.join(projectDir, "electron.asar"), path.join(projectDir, "someAsarFile.asar")) + + await build({ + targets: Platform.LINUX.createTarget(), + projectDir: projectDir, + }) + + await assertThat(path.join(projectDir, "dist")).isDirectory() + await assertThat(path.join(projectDir, "dist", "linux-unpacked", "resources", "someAsarFile.asar")).isFile() + }, })) test.ifNotWindows("no-author-email", appThrows(/Please specify author 'email' in .+/, {targets: Platform.LINUX.createTarget("deb")}, { diff --git a/yarn.lock b/yarn.lock index 96478f6da1f..61b057a7a1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2776,8 +2776,8 @@ type-check@~0.3.2: prelude-ls "~1.1.2" typescript@^2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.5.tgz#6fe9479e00e01855247cea216e7561bafcdbcd4a" + version "2.2.0" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.0.tgz#626f2fc70087d2480f21ebb12c1888288c8614e3" uc.micro@^1.0.1, uc.micro@^1.0.3: version "1.0.3"