diff --git a/.babelrc b/.babelrc
index 5c5ae7d7630..31b9cb9b12a 100644
--- a/.babelrc
+++ b/.babelrc
@@ -5,7 +5,7 @@
[
"transform-async-to-module-method",
{
- module: "bluebird-lst-c",
+ module: "bluebird-lst",
method: "coroutine"
}
],
@@ -27,7 +27,7 @@
[
"transform-async-to-module-method",
{
- module: "bluebird-lst-c",
+ module: "bluebird-lst",
method: "coroutine"
}
],
diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml
index c0ee933945b..6ffe85588d2 100644
--- a/.idea/dictionaries/develar.xml
+++ b/.idea/dictionaries/develar.xml
@@ -181,6 +181,7 @@
srcfolder
templating
testapp
+ thenable
timestamping
tsconfig
udbz
diff --git a/.idea/runConfigurations/compile.xml b/.idea/runConfigurations/compile.xml
deleted file mode 100644
index a6468b5ef66..00000000000
--- a/.idea/runConfigurations/compile.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/lint.xml b/.idea/runConfigurations/lint.xml
deleted file mode 100644
index 8df3d52dfcf..00000000000
--- a/.idea/runConfigurations/lint.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/test.xml b/.idea/runConfigurations/test.xml
deleted file mode 100644
index 84118f5c69f..00000000000
--- a/.idea/runConfigurations/test.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/package.json b/package.json
index 35b67b6b5ea..7afcbe26400 100644
--- a/package.json
+++ b/package.json
@@ -26,15 +26,15 @@
"7zip-bin": "^2.0.4",
"archiver": "^1.3.0",
"asar-electron-builder": "^0.13.5",
- "aws-sdk": "^2.13.0",
- "bluebird-lst-c": "^1.0.6",
+ "aws-sdk": "^2.15.0",
+ "bluebird-lst": "^1.0.1",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
"cuint": "^0.2.2",
"debug": "^2.6.1",
"electron-download-tf": "3.2.0",
"electron-macos-sign": "~1.6.0",
- "fs-extra-p": "^3.1.0",
+ "fs-extra-p": "^4.0.1",
"hosted-git-info": "^2.2.0",
"ini": "^1.3.4",
"is-ci": "^1.0.10",
@@ -80,7 +80,7 @@
"lerna": "2.0.0-beta.37",
"path-sort": "^0.1.0",
"source-map-support": "^0.4.11",
- "ts-babel": "^1.3.6",
+ "ts-babel": "^1.3.7",
"tslint": "^4.4.2",
"typescript": "^2.2.0",
"typescript-json-schema": "^0.9.0",
diff --git a/packages/electron-builder-http/package.json b/packages/electron-builder-http/package.json
index a545272ac9a..5680305dee2 100644
--- a/packages/electron-builder-http/package.json
+++ b/packages/electron-builder-http/package.json
@@ -13,7 +13,7 @@
"//": "client can also install js-yaml to load yaml",
"dependencies": {
"debug": "2.6.1",
- "fs-extra-p": "^3.1.0"
+ "fs-extra-p": "^4.0.1"
},
"typings": "./out/electron-builder-http.d.ts"
}
diff --git a/packages/electron-builder-http/src/CancellationToken.ts b/packages/electron-builder-http/src/CancellationToken.ts
index db882e7f754..12b669ba4a2 100644
--- a/packages/electron-builder-http/src/CancellationToken.ts
+++ b/packages/electron-builder-http/src/CancellationToken.ts
@@ -1,7 +1,9 @@
+import BluebirdPromise from "bluebird-lst"
import { EventEmitter } from "events"
-import BluebirdPromise from "bluebird-lst-c"
export class CancellationToken extends EventEmitter {
+ private parentCancelHandler: any | null = null
+
private _cancelled: boolean
get cancelled(): boolean {
return this._cancelled || (this._parent != null && this._parent.cancelled)
@@ -9,14 +11,21 @@ export class CancellationToken extends EventEmitter {
private _parent: CancellationToken | null
set parent(value: CancellationToken) {
+ this.removeParentCancelHandler()
+
this._parent = value
+ this.parentCancelHandler = () => this.cancel()
+ this._parent.onCancel(this.parentCancelHandler)
}
// babel cannot compile ... correctly for super calls
- constructor() {
+ constructor(parent?: CancellationToken) {
super()
this._cancelled = false
+ if (parent != null) {
+ this.parent = parent
+ }
}
cancel() {
@@ -24,14 +33,76 @@ export class CancellationToken extends EventEmitter {
this.emit("cancel")
}
- onCancel(handler: () => any) {
- this.once("cancel", handler)
+ private onCancel(handler: () => any) {
+ if (this.cancelled) {
+ handler()
+ }
+ else {
+ this.once("cancel", handler)
+ }
}
- trackPromise(promise: BluebirdPromise): BluebirdPromise {
- const handler = () => promise.cancel()
- this.onCancel(handler)
- // it is important to return promise, otherwise will be unhandled rejection error on reject
- return promise.finally(() => this.removeListener("cancel", handler))
+ createPromise(callback: (resolve: (thenableOrResult?: R) => void, reject: (error?: any) => void, onCancel: (callback: () => void) => void) => void): Promise {
+ if (this.cancelled) {
+ return BluebirdPromise.reject(new CancellationError())
+ }
+
+ let cancelHandler: (() => void) | null = null
+ return new BluebirdPromise((resolve, reject) => {
+ let addedCancelHandler: (() => void) | null = null
+
+ cancelHandler = () => {
+ try {
+ if (addedCancelHandler != null) {
+ addedCancelHandler()
+ addedCancelHandler = null
+ }
+ }
+ finally {
+ reject(new CancellationError())
+ }
+ }
+
+ if (this.cancelled) {
+ cancelHandler()
+ return
+ }
+
+ this.onCancel(cancelHandler)
+
+ callback(resolve, reject, (callback: () => void) => {
+ addedCancelHandler = callback
+ })
+ })
+ .finally(() => {
+ if (cancelHandler != null) {
+ this.removeListener("cancel", cancelHandler)
+ cancelHandler = null
+ }
+ })
+ }
+
+ private removeParentCancelHandler() {
+ const parent = this._parent
+ if (parent != null && this.parentCancelHandler != null) {
+ parent.removeListener("cancel", this.parentCancelHandler)
+ this.parentCancelHandler = null
+ }
+ }
+
+ dispose() {
+ try {
+ this.removeParentCancelHandler()
+ }
+ finally {
+ this.removeAllListeners()
+ this._parent = null
+ }
+ }
+}
+
+export class CancellationError extends Error {
+ constructor() {
+ super("Cancelled")
}
}
\ No newline at end of file
diff --git a/packages/electron-builder-http/src/httpExecutor.ts b/packages/electron-builder-http/src/httpExecutor.ts
index d68cb749b39..edd10889b03 100644
--- a/packages/electron-builder-http/src/httpExecutor.ts
+++ b/packages/electron-builder-http/src/httpExecutor.ts
@@ -1,14 +1,14 @@
import { createHash } from "crypto"
-import { Transform } from "stream"
+import _debug from "debug"
+import { EventEmitter } from "events"
import { createWriteStream } from "fs-extra-p"
import { RequestOptions } from "http"
-import { parse as parseUrl } from "url"
-import _debug from "debug"
-import { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"
import { safeLoad } from "js-yaml"
-import { EventEmitter } from "events"
import { Socket } from "net"
+import { Transform } from "stream"
+import { parse as parseUrl } from "url"
import { CancellationToken } from "./CancellationToken"
+import { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"
export interface RequestHeaders {
[key: string]: any
@@ -149,7 +149,7 @@ export abstract class HttpExecutor {
protected abstract doRequest(options: any, callback: (response: any) => void): any
- protected doDownload(requestOptions: any, destination: string, redirectCount: number, options: DownloadOptions, callback: (error: Error | null) => void) {
+ protected doDownload(requestOptions: any, destination: string, redirectCount: number, options: DownloadOptions, callback: (error: Error | null) => void, onCancel: (callback: () => void) => void) {
const request = this.doRequest(requestOptions, (response: Electron.IncomingMessage) => {
if (response.statusCode >= 400) {
callback(new Error(`Cannot download "${requestOptions.protocol || "https"}://${requestOptions.hostname}/${requestOptions.path}", status ${response.statusCode}: ${response.statusMessage}`))
@@ -164,7 +164,7 @@ export abstract class HttpExecutor {
hostname: parsedUrl.hostname,
path: parsedUrl.path,
port: parsedUrl.port == null ? undefined : parsedUrl.port
- }), destination, redirectCount++, options, callback)
+ }), destination, redirectCount++, options, callback, onCancel)
}
else {
callback(new Error(`Too many redirects (> ${this.maxRedirects})`))
@@ -172,10 +172,11 @@ export abstract class HttpExecutor {
return
}
- configurePipes(options, response, destination, callback)
+ configurePipes(options, response, destination, callback, options.cancellationToken)
})
this.addTimeOutHandler(request, callback)
request.on("error", callback)
+ onCancel(() => request.abort())
request.end()
}
@@ -240,7 +241,7 @@ function safeGetHeader(response: any, headerKey: string) {
}
}
-function configurePipes(options: DownloadOptions, response: any, destination: string, callback: (error: Error | null) => void) {
+function configurePipes(options: DownloadOptions, response: any, destination: string, callback: (error: Error | null) => void, cancellationToken: CancellationToken) {
if (!checkSha2(safeGetHeader(response, "X-Checksum-Sha2"), options.sha2, callback)) {
return
}
@@ -262,11 +263,17 @@ function configurePipes(options: DownloadOptions, response: any, destination: st
let lastStream = response
for (const stream of streams) {
- stream.on("error", callback)
+ stream.on("error", (error: Error) => {
+ if (!cancellationToken.cancelled) {
+ callback(error)
+ }
+ })
lastStream = lastStream.pipe(stream)
}
- fileOut.on("finish", () => (fileOut.close)(callback))
+ fileOut.on("finish", () => {
+ (fileOut.close)(callback)
+ })
}
export function configureRequestOptions(options: RequestOptions, token?: string | null, method?: "GET" | "DELETE" | "PUT"): RequestOptions {
diff --git a/packages/electron-builder-publisher/package.json b/packages/electron-builder-publisher/package.json
index ce8572bc8a6..ea688bdc504 100644
--- a/packages/electron-builder-publisher/package.json
+++ b/packages/electron-builder-publisher/package.json
@@ -11,9 +11,9 @@
"out"
],
"dependencies": {
- "fs-extra-p": "^3.1.0",
+ "fs-extra-p": "^4.0.1",
"mime": "^1.3.4",
- "bluebird-lst-c": "^1.0.6",
+ "bluebird-lst": "^1.0.1",
"electron-builder-http": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release",
"chalk": "^1.1.3",
diff --git a/packages/electron-builder-publisher/src/BintrayPublisher.ts b/packages/electron-builder-publisher/src/BintrayPublisher.ts
index f131ab74ce6..79377e5d4fd 100644
--- a/packages/electron-builder-publisher/src/BintrayPublisher.ts
+++ b/packages/electron-builder-publisher/src/BintrayPublisher.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { configureRequestOptions, HttpError } from "electron-builder-http"
import { BintrayClient, Version } from "electron-builder-http/out/bintray"
import { BintrayOptions } from "electron-builder-http/out/publishOptions"
diff --git a/packages/electron-builder-publisher/src/gitHubPublisher.ts b/packages/electron-builder-publisher/src/gitHubPublisher.ts
index 6c292c12e47..89fe2703e07 100644
--- a/packages/electron-builder-publisher/src/gitHubPublisher.ts
+++ b/packages/electron-builder-publisher/src/gitHubPublisher.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { configureRequestOptions, HttpError } from "electron-builder-http"
import { GithubOptions } from "electron-builder-http/out/publishOptions"
import { debug, isEmptyOrSpaces } from "electron-builder-util"
diff --git a/packages/electron-builder-squirrel-windows/package.json b/packages/electron-builder-squirrel-windows/package.json
index 1eabe79a995..425ef5529d2 100644
--- a/packages/electron-builder-squirrel-windows/package.json
+++ b/packages/electron-builder-squirrel-windows/package.json
@@ -13,8 +13,8 @@
"dependencies": {
"electron-builder-util": "~0.0.0-semantic-release",
"electron-builder-core": "~0.0.0-semantic-release",
- "bluebird-lst-c": "^1.0.6",
- "fs-extra-p": "^3.1.0",
+ "bluebird-lst": "^1.0.1",
+ "fs-extra-p": "^4.0.1",
"archiver": "^1.3.0"
},
"typings": "./out/electron-builder-squirrel-windows.d.ts"
diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts
index a5b5003b4da..6540dfd0f40 100644
--- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts
+++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts
@@ -1,10 +1,10 @@
-import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
-import { remove, copy, createWriteStream, unlink, ensureDir, stat } from "fs-extra-p"
-import { spawn, exec, prepareArgs, execWine, debug } from "electron-builder-util"
-import { WinPackager } from "electron-builder/out/winPackager"
+import BluebirdPromise from "bluebird-lst"
+import { debug, exec, execWine, prepareArgs, spawn } from "electron-builder-util"
+import { copyFile, walk } from "electron-builder-util/out/fs"
import { log } from "electron-builder-util/out/log"
-import { walk, copyFile } from "electron-builder-util/out/fs"
+import { WinPackager } from "electron-builder/out/winPackager"
+import { copy, createWriteStream, ensureDir, remove, stat, unlink } from "fs-extra-p"
+import * as path from "path"
const archiver = require("archiver")
diff --git a/packages/electron-builder-util/package.json b/packages/electron-builder-util/package.json
index 787001e754b..6d4ecc42f59 100644
--- a/packages/electron-builder-util/package.json
+++ b/packages/electron-builder-util/package.json
@@ -11,10 +11,10 @@
"out"
],
"dependencies": {
- "fs-extra-p": "^3.1.0",
+ "fs-extra-p": "^4.0.1",
"is-ci": "^1.0.10",
"stat-mode": "^0.2.2",
- "bluebird-lst-c": "^1.0.6",
+ "bluebird-lst": "^1.0.1",
"chalk": "^1.1.3",
"debug": "2.6.1",
"node-emoji": "^1.5.1",
diff --git a/packages/electron-builder-util/src/binDownload.ts b/packages/electron-builder-util/src/binDownload.ts
index 7dccb1fff23..70e1d5351c8 100644
--- a/packages/electron-builder-util/src/binDownload.ts
+++ b/packages/electron-builder-util/src/binDownload.ts
@@ -1,11 +1,11 @@
-import { spawn, debug, debug7zArgs, getTempName, getCacheDirectory } from "./util"
-import { rename, unlink, emptyDir } from "fs-extra-p"
import { path7za } from "7zip-bin"
+import BluebirdPromise from "bluebird-lst"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { emptyDir, rename, unlink } from "fs-extra-p"
import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
import { statOrNull } from "./fs"
import { httpExecutor } from "./nodeHttpExecutor"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { debug, debug7zArgs, getCacheDirectory, getTempName, spawn } from "./util"
const versionToPromise = new Map>()
diff --git a/packages/electron-builder-util/src/fs.ts b/packages/electron-builder-util/src/fs.ts
index 3284f839868..3a74d691633 100644
--- a/packages/electron-builder-util/src/fs.ts
+++ b/packages/electron-builder-util/src/fs.ts
@@ -1,9 +1,9 @@
-import { unlink, access, stat, Stats, lstat, readdir, createReadStream, createWriteStream, link, mkdirs, readlink, symlink } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
-import * as path from "path"
-import { debug } from "./util"
+import BluebirdPromise from "bluebird-lst"
+import { access, createReadStream, createWriteStream, link, lstat, mkdirs, readdir, readlink, stat, Stats, symlink, unlink } from "fs-extra-p"
import isCi from "is-ci"
+import * as path from "path"
import Mode from "stat-mode"
+import { debug } from "./util"
export const MAX_FILE_REQUESTS = 8
export const CONCURRENCY = {concurrency: MAX_FILE_REQUESTS}
diff --git a/packages/electron-builder-util/src/log.ts b/packages/electron-builder-util/src/log.ts
index 70dfec818d8..97d9bb50a85 100644
--- a/packages/electron-builder-util/src/log.ts
+++ b/packages/electron-builder-util/src/log.ts
@@ -1,7 +1,7 @@
+import BluebirdPromise from "bluebird-lst"
import { yellow } from "chalk"
-import WritableStream = NodeJS.WritableStream
-import BluebirdPromise from "bluebird-lst-c"
import { get as getEmoji } from "node-emoji"
+import WritableStream = NodeJS.WritableStream
let printer: ((message: string) => void) | null = null
diff --git a/packages/electron-builder-util/src/nodeHttpExecutor.ts b/packages/electron-builder-util/src/nodeHttpExecutor.ts
index 5f7e93cc7b4..43c9e8f3d73 100644
--- a/packages/electron-builder-util/src/nodeHttpExecutor.ts
+++ b/packages/electron-builder-util/src/nodeHttpExecutor.ts
@@ -1,20 +1,19 @@
-import { IncomingMessage, ClientRequest, Agent } from "http"
-import * as https from "https"
+import { configureRequestOptions, DownloadOptions, HttpExecutor } from "electron-builder-http"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
import { ensureDir, readFile } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
-import * as path from "path"
-import { homedir } from "os"
-import { parse as parseIni } from "ini"
-import { HttpExecutor, DownloadOptions, configureRequestOptions } from "electron-builder-http"
+import { Agent, ClientRequest, IncomingMessage } from "http"
+import * as https from "https"
import { RequestOptions } from "https"
+import { parse as parseIni } from "ini"
+import { homedir } from "os"
+import * as path from "path"
import { parse as parseUrl } from "url"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
export class NodeHttpExecutor extends HttpExecutor {
private httpsAgentPromise: Promise | null
- async download(url: string, destination: string, options?: DownloadOptions | null): Promise {
- if (options == null || !options.skipDirCreation) {
+ async download(url: string, destination: string, options: DownloadOptions): Promise {
+ if (!options.skipDirCreation) {
await ensureDir(path.dirname(destination))
}
@@ -23,21 +22,21 @@ export class NodeHttpExecutor extends HttpExecutor((resolve, reject) => {
+ return await options.cancellationToken.createPromise((resolve, reject, onCancel) => {
const parsedUrl = parseUrl(url)
this.doDownload(configureRequestOptions({
hostname: parsedUrl.hostname,
path: parsedUrl.path,
- headers: (options == null ? null : options.headers) || undefined,
+ headers: options.headers || undefined,
agent: agent,
- }), destination, 0, options || {cancellationToken: new CancellationToken()}, (error: Error) => {
+ }), destination, 0, options, (error: Error) => {
if (error == null) {
resolve(destination)
}
else {
reject(error)
}
- })
+ }, onCancel)
})
}
@@ -46,7 +45,7 @@ export class NodeHttpExecutor extends HttpExecutor((resolve, reject, onCancel) => {
+ return cancellationToken.createPromise((resolve, reject, onCancel) => {
const request = https.request(options, (response: IncomingMessage) => {
try {
this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor)
@@ -59,8 +58,8 @@ export class NodeHttpExecutor extends HttpExecutor request.abort())
- }))
+ onCancel(() => request.abort())
+ })
}
protected doRequest(options: any, callback: (response: any) => void): any {
diff --git a/packages/electron-builder-util/src/promise.ts b/packages/electron-builder-util/src/promise.ts
index 49333fd1fc7..ab617881b4a 100644
--- a/packages/electron-builder-util/src/promise.ts
+++ b/packages/electron-builder-util/src/promise.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { red } from "chalk"
export function printErrorAndExit(error: Error) {
diff --git a/packages/electron-builder-util/src/tmp.ts b/packages/electron-builder-util/src/tmp.ts
index 61aa319213a..2793901fcad 100644
--- a/packages/electron-builder-util/src/tmp.ts
+++ b/packages/electron-builder-util/src/tmp.ts
@@ -1,10 +1,10 @@
+import BluebirdPromise from "bluebird-lst"
+import { mkdirs, mkdtemp, remove, removeSync } from "fs-extra-p"
import { tmpdir } from "os"
-import { remove, mkdirs, removeSync, mkdtemp } from "fs-extra-p"
import * as path from "path"
-import { getTempName } from "./util"
-import BluebirdPromise from "bluebird-lst-c"
import { warn } from "./log"
import { all } from "./promise"
+import { getTempName } from "./util"
process.setMaxListeners(30)
diff --git a/packages/electron-builder-util/src/util.ts b/packages/electron-builder-util/src/util.ts
index 17a4d2d1147..69af53e437d 100644
--- a/packages/electron-builder-util/src/util.ts
+++ b/packages/electron-builder-util/src/util.ts
@@ -1,13 +1,13 @@
-import { execFile, spawn as _spawn, ChildProcess, SpawnOptions } from "child_process"
-import BluebirdPromise from "bluebird-lst-c"
+import "source-map-support/register"
+import BluebirdPromise from "bluebird-lst"
+import { red, yellow } from "chalk"
+import { ChildProcess, execFile, spawn as _spawn, SpawnOptions } from "child_process"
+import { createHash } from "crypto"
+import _debug from "debug"
import { homedir, tmpdir } from "os"
import * as path from "path"
-import { yellow, red } from "chalk"
-import _debug from "debug"
-import { warn, log } from "./log"
-import { createHash } from "crypto"
-import "source-map-support/register"
import { statOrNull } from "./fs"
+import { log, warn } from "./log"
export const debug = _debug("electron-builder")
export const debug7z = _debug("electron-builder:7z")
diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json
index f6397914288..06ec506fced 100644
--- a/packages/electron-builder/package.json
+++ b/packages/electron-builder/package.json
@@ -46,7 +46,7 @@
"dependencies": {
"7zip-bin": "^2.0.4",
"asar-electron-builder": "^0.13.5",
- "bluebird-lst-c": "^1.0.6",
+ "bluebird-lst": "^1.0.1",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
"cuint": "^0.2.2",
@@ -56,7 +56,7 @@
"electron-builder-publisher": "0.0.0-semantic-release",
"electron-download-tf": "3.2.0",
"electron-macos-sign": "~1.6.0",
- "fs-extra-p": "^3.1.0",
+ "fs-extra-p": "^4.0.1",
"hosted-git-info": "^2.2.0",
"is-ci": "^1.0.10",
"isbinaryfile": "^3.0.2",
diff --git a/packages/electron-builder/src/asarUtil.ts b/packages/electron-builder/src/asarUtil.ts
index 8c15f509f7b..4f97ae08f54 100644
--- a/packages/electron-builder/src/asarUtil.ts
+++ b/packages/electron-builder/src/asarUtil.ts
@@ -1,11 +1,11 @@
import { AsarFileInfo, listPackage, statFile } from "asar-electron-builder"
+import BluebirdPromise from "bluebird-lst"
import { debug } from "electron-builder-util"
-import { readFile, Stats, createWriteStream, ensureDir, createReadStream, readJson, writeFile, readlink, stat } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
-import * as path from "path"
-import { log } from "electron-builder-util/out/log"
import { deepAssign } from "electron-builder-util/out/deepAssign"
-import { walk, statOrNull, CONCURRENCY, MAX_FILE_REQUESTS, Filter, FileCopier } from "electron-builder-util/out/fs"
+import { CONCURRENCY, FileCopier, Filter, MAX_FILE_REQUESTS, statOrNull, walk } from "electron-builder-util/out/fs"
+import { log } from "electron-builder-util/out/log"
+import { createReadStream, createWriteStream, ensureDir, readFile, readJson, readlink, stat, Stats, writeFile } from "fs-extra-p"
+import * as path from "path"
import { AsarOptions } from "./metadata"
const isBinaryFile: any = BluebirdPromise.promisify(require("isbinaryfile"))
diff --git a/packages/electron-builder/src/builder.ts b/packages/electron-builder/src/builder.ts
index 090b2a27197..0be41565eba 100644
--- a/packages/electron-builder/src/builder.ts
+++ b/packages/electron-builder/src/builder.ts
@@ -1,14 +1,14 @@
-import { Packager, normalizePlatforms } from "./packager"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, archFromString, Platform } from "electron-builder-core"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
import { PublishOptions } from "electron-builder-publisher"
-import { executeFinally } from "electron-builder-util/out/promise"
-import BluebirdPromise from "bluebird-lst-c"
import { isEmptyOrSpaces } from "electron-builder-util"
-import { Platform, Arch, archFromString } from "electron-builder-core"
-import { DIR_TARGET } from "./targets/targetFactory"
+import { warn } from "electron-builder-util/out/log"
+import { executeFinally } from "electron-builder-util/out/promise"
+import { normalizePlatforms, Packager } from "./packager"
import { PackagerOptions } from "./packagerApi"
import { PublishManager } from "./publish/PublishManager"
-import { warn } from "electron-builder-util/out/log"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { DIR_TARGET } from "./targets/targetFactory"
export interface BuildOptions extends PackagerOptions, PublishOptions {
}
@@ -214,11 +214,10 @@ export async function build(rawOptions?: CliOptions): Promise> {
})
const publishManager = new PublishManager(packager, options, cancellationToken)
- const buildPromise = >>packager.build().then(() => Array.from(artifactPaths))
+ const buildPromise = packager.build().then(() => Array.from(artifactPaths))
process.on("SIGINT", () => {
warn("Cancelled by SIGINT")
cancellationToken.cancel()
- buildPromise.cancel()
publishManager.cancelTasks()
})
diff --git a/packages/electron-builder/src/cli/install-app-deps.ts b/packages/electron-builder/src/cli/install-app-deps.ts
index 0bbb2236a28..f6b38d0683b 100644
--- a/packages/electron-builder/src/cli/install-app-deps.ts
+++ b/packages/electron-builder/src/cli/install-app-deps.ts
@@ -1,10 +1,10 @@
#! /usr/bin/env node
+import BluebirdPromise from "bluebird-lst"
import { computeDefaultAppDirectory, use } from "electron-builder-util"
import { printErrorAndExit } from "electron-builder-util/out/promise"
-import BluebirdPromise from "bluebird-lst-c"
import yargs from "yargs"
-import { loadConfig, getElectronVersion } from "../util/readPackageJson"
+import { getElectronVersion, loadConfig } from "../util/readPackageJson"
import { installOrRebuild } from "../yarn"
async function main() {
diff --git a/packages/electron-builder/src/codeSign.ts b/packages/electron-builder/src/codeSign.ts
index d29098b538a..9f452d5184b 100644
--- a/packages/electron-builder/src/codeSign.ts
+++ b/packages/electron-builder/src/codeSign.ts
@@ -1,14 +1,14 @@
-import { exec, getTempName, isEmptyOrSpaces, getCacheDirectory } from "electron-builder-util"
-import { deleteFile, outputFile, copy, rename } from "fs-extra-p"
-import { download } from "electron-builder-http"
-import * as path from "path"
-import { executeFinally, all } from "electron-builder-util/out/promise"
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { randomBytes } from "crypto"
-import { TmpDir } from "electron-builder-util/out/tmp"
-import { homedir } from "os"
+import { download } from "electron-builder-http"
+import { exec, getCacheDirectory, getTempName, isEmptyOrSpaces } from "electron-builder-util"
import { statOrNull } from "electron-builder-util/out/fs"
+import { all, executeFinally } from "electron-builder-util/out/promise"
+import { TmpDir } from "electron-builder-util/out/tmp"
+import { copy, deleteFile, outputFile, rename } from "fs-extra-p"
import isCi from "is-ci"
+import { homedir } from "os"
+import * as path from "path"
export const appleCertificatePrefixes = ["Developer ID Application:", "Developer ID Installer:", "3rd Party Mac Developer Application:", "3rd Party Mac Developer Installer:"]
diff --git a/packages/electron-builder/src/fileMatcher.ts b/packages/electron-builder/src/fileMatcher.ts
index 98f7ea88eb8..7aed6fec922 100644
--- a/packages/electron-builder/src/fileMatcher.ts
+++ b/packages/electron-builder/src/fileMatcher.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { asArray } from "electron-builder-util"
import { copyDir, copyFile, Filter, statOrNull } from "electron-builder-util/out/fs"
import { warn } from "electron-builder-util/out/log"
diff --git a/packages/electron-builder/src/macPackager.ts b/packages/electron-builder/src/macPackager.ts
index 6be542cf430..6e25e84de53 100644
--- a/packages/electron-builder/src/macPackager.ts
+++ b/packages/electron-builder/src/macPackager.ts
@@ -1,19 +1,18 @@
-import { PlatformPackager } from "./platformPackager"
-import { MasBuildOptions, MacOptions } from "./options/macOptions"
-import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
-import { warn, task } from "electron-builder-util/out/log"
-import { createKeychain, CodeSigningInfo, findIdentity, appleCertificatePrefixes } from "./codeSign"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Platform, Target } from "electron-builder-core"
+import { exec } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
+import { log, task, warn } from "electron-builder-util/out/log"
import { signAsync, SignOptions } from "electron-macos-sign"
-import { DmgTarget } from "./targets/dmg"
-import { createCommonTarget, DIR_TARGET, NoOpTarget } from "./targets/targetFactory"
+import * as path from "path"
import { AppInfo } from "./appInfo"
-import { PkgTarget, prepareProductBuildArgs } from "./targets/pkg"
-import { exec } from "electron-builder-util"
-import { Target, Platform, Arch } from "electron-builder-core"
+import { appleCertificatePrefixes, CodeSigningInfo, createKeychain, findIdentity } from "./codeSign"
+import { MacOptions, MasBuildOptions } from "./options/macOptions"
import { BuildInfo } from "./packagerApi"
-import { log } from "electron-builder-util/out/log"
+import { PlatformPackager } from "./platformPackager"
+import { DmgTarget } from "./targets/dmg"
+import { PkgTarget, prepareProductBuildArgs } from "./targets/pkg"
+import { createCommonTarget, DIR_TARGET, NoOpTarget } from "./targets/targetFactory"
export default class MacPackager extends PlatformPackager {
readonly codeSigningInfo: Promise
diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts
index 9bb188ce7a0..b0b113d3bf2 100644
--- a/packages/electron-builder/src/packager.ts
+++ b/packages/electron-builder/src/packager.ts
@@ -1,7 +1,8 @@
import { extractFile } from "asar-electron-builder"
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { Arch, Platform, Target } from "electron-builder-core"
-import { computeDefaultAppDirectory, exec, isEmptyOrSpaces, use, debug } from "electron-builder-util"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { computeDefaultAppDirectory, debug, exec, isEmptyOrSpaces, use } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
import { log, warn } from "electron-builder-util/out/log"
import { all, executeFinally } from "electron-builder-util/out/promise"
@@ -19,7 +20,6 @@ import { createTargets } from "./targets/targetFactory"
import { doLoadConfig, getElectronVersion, loadConfig, readPackageJson } from "./util/readPackageJson"
import { WinPackager } from "./winPackager"
import { getGypEnv, installOrRebuild } from "./yarn"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
function addHandler(emitter: EventEmitter, event: string, handler: Function) {
emitter.on(event, handler)
diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts
index 7c50aa500ec..382a0bdc4b3 100644
--- a/packages/electron-builder/src/packager/dirPackager.ts
+++ b/packages/electron-builder/src/packager/dirPackager.ts
@@ -1,11 +1,11 @@
-import BluebirdPromise from "bluebird-lst-c"
-import { emptyDir, chmod } from "fs-extra-p"
-import { warn } from "electron-builder-util/out/log"
-import { PlatformPackager } from "../platformPackager"
-import { debug7zArgs, spawn } from "electron-builder-util"
import { path7za } from "7zip-bin"
-import * as path from "path"
+import BluebirdPromise from "bluebird-lst"
+import { debug7zArgs, spawn } from "electron-builder-util"
import { copyDir } from "electron-builder-util/out/fs"
+import { warn } from "electron-builder-util/out/log"
+import { chmod, emptyDir } from "fs-extra-p"
+import * as path from "path"
+import { PlatformPackager } from "../platformPackager"
const downloadElectron: (options: any) => Promise = BluebirdPromise.promisify(require("electron-download-tf"))
diff --git a/packages/electron-builder/src/packager/mac.ts b/packages/electron-builder/src/packager/mac.ts
index 2b35fefa776..b35e76218a9 100644
--- a/packages/electron-builder/src/packager/mac.ts
+++ b/packages/electron-builder/src/packager/mac.ts
@@ -1,12 +1,12 @@
-import { rename, readFile, writeFile, unlink, utimes, copy } from "fs-extra-p"
-import * as path from "path"
-import { parse as parsePlist, build as buildPlist } from "plist"
-import BluebirdPromise from "bluebird-lst-c"
-import { use, asArray } from "electron-builder-util"
-import { normalizeExt, PlatformPackager } from "../platformPackager"
+import BluebirdPromise from "bluebird-lst"
+import { asArray, use } from "electron-builder-util"
+import { copyFile, unlinkIfExists } from "electron-builder-util/out/fs"
import { warn } from "electron-builder-util/out/log"
-import { unlinkIfExists, copyFile } from "electron-builder-util/out/fs"
+import { copy, readFile, rename, unlink, utimes, writeFile } from "fs-extra-p"
+import * as path from "path"
+import { build as buildPlist, parse as parsePlist } from "plist"
import { getPlatformIconFileName } from "../metadata"
+import { normalizeExt, PlatformPackager } from "../platformPackager"
function doRename(basePath: string, oldName: string, newName: string) {
return rename(path.join(basePath, oldName), path.join(basePath, newName))
diff --git a/packages/electron-builder/src/platformPackager.ts b/packages/electron-builder/src/platformPackager.ts
index 48260992ec7..6e04ba7380f 100644
--- a/packages/electron-builder/src/platformPackager.ts
+++ b/packages/electron-builder/src/platformPackager.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { Arch, getArchSuffix, Platform, Target, TargetSpecificOptions } from "electron-builder-core"
import { asArray, debug, isEmptyOrSpaces, use } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
diff --git a/packages/electron-builder/src/publish/PublishManager.ts b/packages/electron-builder/src/publish/PublishManager.ts
index b986d16ef44..48307421673 100644
--- a/packages/electron-builder/src/publish/PublishManager.ts
+++ b/packages/electron-builder/src/publish/PublishManager.ts
@@ -1,11 +1,16 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { createHash } from "crypto"
import { Arch, Platform } from "electron-builder-core"
-import { GenericServerOptions, GithubOptions, PublishConfiguration, S3Options, UpdateInfo, VersionInfo, s3Url, githubUrl } from "electron-builder-http/out/publishOptions"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { GenericServerOptions, GithubOptions, githubUrl, PublishConfiguration, S3Options, s3Url, UpdateInfo, VersionInfo } from "electron-builder-http/out/publishOptions"
+import { HttpPublisher, PublishContext, Publisher, PublishOptions } from "electron-builder-publisher"
+import { BintrayPublisher } from "electron-builder-publisher/out/BintrayPublisher"
+import { GitHubPublisher } from "electron-builder-publisher/out/gitHubPublisher"
+import { MultiProgress } from "electron-builder-publisher/out/multiProgress"
import { asArray, debug, isEmptyOrSpaces } from "electron-builder-util"
import { log } from "electron-builder-util/out/log"
import { throwError } from "electron-builder-util/out/promise"
-import { createReadStream, outputJson, writeFile, ensureDir } from "fs-extra-p"
+import { createReadStream, ensureDir, outputJson, writeFile } from "fs-extra-p"
import isCi from "is-ci"
import { safeDump } from "js-yaml"
import * as path from "path"
@@ -14,13 +19,8 @@ import { Macros, PlatformSpecificBuildOptions } from "../metadata"
import { Packager } from "../packager"
import { ArtifactCreated, BuildInfo } from "../packagerApi"
import { PlatformPackager } from "../platformPackager"
-import { BintrayPublisher } from "electron-builder-publisher/out/BintrayPublisher"
-import { GitHubPublisher } from "electron-builder-publisher/out/gitHubPublisher"
-import { getCiTag, getResolvedPublishConfig } from "./publisher"
-import { Publisher, HttpPublisher, PublishOptions, PublishContext } from "electron-builder-publisher"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
-import { MultiProgress } from "electron-builder-publisher/out/multiProgress"
import { WinPackager } from "../winPackager"
+import { getCiTag, getResolvedPublishConfig } from "./publisher"
export class PublishManager implements PublishContext {
private readonly nameToPublisher = new Map()
@@ -122,7 +122,7 @@ export class PublishManager implements PublishContext {
}
if (target != null && event.file != null && !this.cancellationToken.cancelled) {
- if ((packager.platform === Platform.MAC && target.name === "zip") || (packager.platform === Platform.WINDOWS && (target.name === "nsis") || target.name.startsWith("nsis-"))) {
+ if ((packager.platform === Platform.MAC && target.name === "zip") || (packager.platform === Platform.WINDOWS && (target.name === "nsis" || target.name.startsWith("nsis-")))) {
this.addTask(writeUpdateInfo(event, publishConfigs))
}
}
diff --git a/packages/electron-builder/src/readInstalled.ts b/packages/electron-builder/src/readInstalled.ts
index 3be269fe3a1..cf51c043706 100644
--- a/packages/electron-builder/src/readInstalled.ts
+++ b/packages/electron-builder/src/readInstalled.ts
@@ -1,6 +1,6 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
+import { lstat, readdir, readJson, realpath } from "fs-extra-p"
import * as path from "path"
-import { readJson, lstat, realpath, readdir } from "fs-extra-p"
export interface Dependency {
name: string
diff --git a/packages/electron-builder/src/repositoryInfo.ts b/packages/electron-builder/src/repositoryInfo.ts
index cd1a3683e84..32f2e0ae097 100644
--- a/packages/electron-builder/src/repositoryInfo.ts
+++ b/packages/electron-builder/src/repositoryInfo.ts
@@ -1,7 +1,7 @@
-import { fromUrl as parseRepositoryUrl, Info } from "hosted-git-info"
import { readFile } from "fs-extra-p"
-import { Metadata, RepositoryInfo } from "./metadata"
+import { fromUrl as parseRepositoryUrl, Info } from "hosted-git-info"
import * as path from "path"
+import { Metadata, RepositoryInfo } from "./metadata"
export interface RepositorySlug {
user: string
@@ -18,7 +18,7 @@ async function getGitUrlFromGitConfig(): Promise {
data = await readFile(path.join(".git", "config"), "utf8")
}
catch (e) {
- if (e.code === "ENOENT") {
+ if (e.code === "ENOENT" || e.code === "ENOTDIR") {
return null
}
diff --git a/packages/electron-builder/src/targets/LinuxTargetHelper.ts b/packages/electron-builder/src/targets/LinuxTargetHelper.ts
index 343e50ef728..08914e9d862 100644
--- a/packages/electron-builder/src/targets/LinuxTargetHelper.ts
+++ b/packages/electron-builder/src/targets/LinuxTargetHelper.ts
@@ -1,9 +1,9 @@
-import { readdir, outputFile, ensureDir } from "fs-extra-p"
+import BluebirdPromise from "bluebird-lst"
+import { debug, exec, isEmptyOrSpaces } from "electron-builder-util"
+import { ensureDir, outputFile, readdir } from "fs-extra-p"
import * as path from "path"
-import { exec, debug, isEmptyOrSpaces } from "electron-builder-util"
-import BluebirdPromise from "bluebird-lst-c"
-import { LinuxBuildOptions } from "../options/linuxOptions"
import { LinuxPackager } from "../linuxPackager"
+import { LinuxBuildOptions } from "../options/linuxOptions"
export const installPrefix = "/opt"
diff --git a/packages/electron-builder/src/targets/appImage.ts b/packages/electron-builder/src/targets/appImage.ts
index f1430903f56..6743cace4d2 100644
--- a/packages/electron-builder/src/targets/appImage.ts
+++ b/packages/electron-builder/src/targets/appImage.ts
@@ -1,15 +1,15 @@
-import * as path from "path"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Target } from "electron-builder-core"
import { exec } from "electron-builder-util"
-import { open, write, createReadStream, createWriteStream, close, chmod } from "fs-extra-p"
-import { LinuxTargetHelper } from "./LinuxTargetHelper"
import { getBin } from "electron-builder-util/out/binDownload"
-import BluebirdPromise from "bluebird-lst-c"
+import { unlinkIfExists } from "electron-builder-util/out/fs"
+import { log } from "electron-builder-util/out/log"
+import { chmod, close, createReadStream, createWriteStream, open, write } from "fs-extra-p"
+import * as path from "path"
import { v1 as uuid1 } from "uuid-1345"
import { LinuxPackager } from "../linuxPackager"
-import { log } from "electron-builder-util/out/log"
-import { Target, Arch } from "electron-builder-core"
-import { unlinkIfExists } from "electron-builder-util/out/fs"
import { AppImageOptions } from "../options/linuxOptions"
+import { LinuxTargetHelper } from "./LinuxTargetHelper"
const appImageVersion = process.platform === "darwin" ? "AppImage-09-07-16-mac" : "AppImage-09-07-16-linux"
//noinspection SpellCheckingInspection
diff --git a/packages/electron-builder/src/targets/appx.ts b/packages/electron-builder/src/targets/appx.ts
index 41268e6f323..edb2f77da89 100644
--- a/packages/electron-builder/src/targets/appx.ts
+++ b/packages/electron-builder/src/targets/appx.ts
@@ -1,15 +1,14 @@
-import { WinPackager } from "../winPackager"
-import { getArchSuffix, Arch } from "electron-builder-core"
-import { use, spawn } from "electron-builder-util"
-import { emptyDir, copy, readFile, writeFile } from "fs-extra-p"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, getArchSuffix, Target } from "electron-builder-core"
+import { spawn, use } from "electron-builder-util"
+import { copyDir } from "electron-builder-util/out/fs"
+import { copy, emptyDir, readFile, writeFile } from "fs-extra-p"
+import { release } from "os"
import * as path from "path"
+import sanitizeFileName from "sanitize-filename"
import { AppXOptions } from "../options/winOptions"
-import BluebirdPromise from "bluebird-lst-c"
-import { Target } from "electron-builder-core"
import { getSignVendorPath } from "../windowsCodeSign"
-import sanitizeFileName from "sanitize-filename"
-import { release } from "os"
-import { copyDir } from "electron-builder-util/out/fs"
+import { WinPackager } from "../winPackager"
export default class AppXTarget extends Target {
private readonly options: AppXOptions = Object.assign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx)
diff --git a/packages/electron-builder/src/targets/dmg.ts b/packages/electron-builder/src/targets/dmg.ts
index 2ed796fa272..782c4b874bb 100644
--- a/packages/electron-builder/src/targets/dmg.ts
+++ b/packages/electron-builder/src/targets/dmg.ts
@@ -1,15 +1,15 @@
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Target } from "electron-builder-core"
+import { debug, exec, isEmptyOrSpaces, spawn, use } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
-import * as path from "path"
+import { exists, statOrNull } from "electron-builder-util/out/fs"
import { log, warn } from "electron-builder-util/out/log"
-import { PlatformPackager } from "../platformPackager"
-import { MacOptions, DmgOptions } from "../options/macOptions"
-import BluebirdPromise from "bluebird-lst-c"
-import { debug, use, exec, isEmptyOrSpaces, spawn } from "electron-builder-util"
-import { copy, unlink, outputFile, remove, readFile } from "fs-extra-p"
import { executeFinally } from "electron-builder-util/out/promise"
+import { copy, outputFile, readFile, remove, unlink } from "fs-extra-p"
+import * as path from "path"
import sanitizeFileName from "sanitize-filename"
-import { Target, Arch } from "electron-builder-core"
-import { exists, statOrNull } from "electron-builder-util/out/fs"
+import { DmgOptions, MacOptions } from "../options/macOptions"
+import { PlatformPackager } from "../platformPackager"
export class DmgTarget extends Target {
private helperDir = path.join(__dirname, "..", "..", "templates", "dmg")
diff --git a/packages/electron-builder/src/targets/fpm.ts b/packages/electron-builder/src/targets/fpm.ts
index 842d1c9e902..906f5009e53 100644
--- a/packages/electron-builder/src/targets/fpm.ts
+++ b/packages/electron-builder/src/targets/fpm.ts
@@ -1,17 +1,16 @@
-import { toLinuxArchString } from "electron-builder-core"
-import { use, exec, smarten } from "electron-builder-util"
-import * as path from "path"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Target, toLinuxArchString } from "electron-builder-core"
+import { exec, smarten, use } from "electron-builder-util"
import { getBin } from "electron-builder-util/out/binDownload"
-import { readFile, outputFile, ensureDir } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
-import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
-import * as errorMessages from "../errorMessages"
+import { unlinkIfExists } from "electron-builder-util/out/fs"
+import { log, warn } from "electron-builder-util/out/log"
import { TmpDir } from "electron-builder-util/out/tmp"
+import { ensureDir, outputFile, readFile } from "fs-extra-p"
+import * as path from "path"
+import * as errorMessages from "../errorMessages"
import { LinuxPackager } from "../linuxPackager"
-import { log, warn } from "electron-builder-util/out/log"
-import { Target, Arch } from "electron-builder-core"
-import { unlinkIfExists } from "electron-builder-util/out/fs"
import { DebOptions } from "../options/linuxOptions"
+import { installPrefix, LinuxTargetHelper } from "./LinuxTargetHelper"
const fpmPath = (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") ?
BluebirdPromise.resolve("fpm") : downloadFpm()
diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts
index 625108d042b..22e4f77ef8a 100644
--- a/packages/electron-builder/src/targets/nsis.ts
+++ b/packages/electron-builder/src/targets/nsis.ts
@@ -1,20 +1,20 @@
-import { WinPackager } from "../winPackager"
-import { exec, debug, doSpawn, handleProcess, use, asArray, isEmptyOrSpaces } from "electron-builder-util"
-import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Platform, Target } from "electron-builder-core"
+import { asArray, debug, doSpawn, exec, handleProcess, isEmptyOrSpaces, use } from "electron-builder-util"
import { getBinFromBintray } from "electron-builder-util/out/binDownload"
+import { copyFile } from "electron-builder-util/out/fs"
+import { log, subTask, warn } from "electron-builder-util/out/log"
+import { readFile, unlink } from "fs-extra-p"
+import * as path from "path"
+import sanitizeFileName from "sanitize-filename"
import { v5 as uuid5 } from "uuid-1345"
-import { normalizeExt } from "../platformPackager"
-import { archive } from "./archive"
-import { subTask, log, warn } from "electron-builder-util/out/log"
-import { unlink, readFile } from "fs-extra-p"
+import { getPlatformIconFileName } from "../metadata"
import { NsisOptions, NsisWebOptions } from "../options/winOptions"
-import { Target, Arch, Platform } from "electron-builder-core"
-import sanitizeFileName from "sanitize-filename"
-import { copyFile } from "electron-builder-util/out/fs"
+import { normalizeExt } from "../platformPackager"
import { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from "../publish/PublishManager"
import { getSignVendorPath } from "../windowsCodeSign"
-import { getPlatformIconFileName } from "../metadata"
+import { WinPackager } from "../winPackager"
+import { archive } from "./archive"
const ELECTRON_BUILDER_NS_UUID = "50e065bc-3134-11e6-9bab-38c9862bdaf3"
diff --git a/packages/electron-builder/src/targets/pkg.ts b/packages/electron-builder/src/targets/pkg.ts
index f0e034c5acb..b1a17dcd874 100644
--- a/packages/electron-builder/src/targets/pkg.ts
+++ b/packages/electron-builder/src/targets/pkg.ts
@@ -1,13 +1,13 @@
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Target } from "electron-builder-core"
import { exec, use } from "electron-builder-util"
-import MacPackager from "../macPackager"
-import * as path from "path"
-import { Target, Arch } from "electron-builder-core"
-import { PkgOptions } from "../options/macOptions"
import { statOrNull } from "electron-builder-util/out/fs"
+import { unlink } from "fs-extra-p"
+import * as path from "path"
import { findIdentity } from "../codeSign"
+import MacPackager from "../macPackager"
+import { PkgOptions } from "../options/macOptions"
import { filterCFBundleIdentifier } from "../packager/mac"
-import { unlink } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/
export class PkgTarget extends Target {
diff --git a/packages/electron-builder/src/winPackager.ts b/packages/electron-builder/src/winPackager.ts
index 354a9384ce6..a3e8ed3f4f0 100644
--- a/packages/electron-builder/src/winPackager.ts
+++ b/packages/electron-builder/src/winPackager.ts
@@ -1,18 +1,18 @@
-import { downloadCertificate } from "./codeSign"
-import BluebirdPromise from "bluebird-lst-c"
-import { PlatformPackager } from "./platformPackager"
+import BluebirdPromise from "bluebird-lst"
import { Platform, Target } from "electron-builder-core"
-import * as path from "path"
+import { asArray, exec, Lazy, use } from "electron-builder-util"
import { log } from "electron-builder-util/out/log"
-import { exec, use, asArray, Lazy } from "electron-builder-util"
-import { open, close, read, rename, readFile } from "fs-extra-p"
-import { sign, SignOptions, getSignVendorPath } from "./windowsCodeSign"
+import { close, open, read, readFile, rename } from "fs-extra-p"
+import * as forge from "node-forge"
+import * as path from "path"
+import { downloadCertificate } from "./codeSign"
+import { WinBuildOptions } from "./options/winOptions"
+import { BuildInfo } from "./packagerApi"
+import { PlatformPackager } from "./platformPackager"
import AppXTarget from "./targets/appx"
import NsisTarget from "./targets/nsis"
import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory"
-import { WinBuildOptions } from "./options/winOptions"
-import { BuildInfo } from "./packagerApi"
-import * as forge from "node-forge"
+import { getSignVendorPath, sign, SignOptions } from "./windowsCodeSign"
export interface FileCodeSigningInfo {
readonly file?: string | null
diff --git a/packages/electron-builder/src/yarn.ts b/packages/electron-builder/src/yarn.ts
index 5d6ebc0af89..5365572c668 100644
--- a/packages/electron-builder/src/yarn.ts
+++ b/packages/electron-builder/src/yarn.ts
@@ -1,10 +1,10 @@
-import BluebirdPromise from "bluebird-lst-c"
-import * as path from "path"
-import { log, warn} from "electron-builder-util/out/log"
+import BluebirdPromise from "bluebird-lst"
+import { asArray, spawn } from "electron-builder-util"
+import { exists } from "electron-builder-util/out/fs"
+import { log, warn } from "electron-builder-util/out/log"
import { homedir } from "os"
-import { spawn, asArray } from "electron-builder-util"
+import * as path from "path"
import { Config } from "./metadata"
-import { exists } from "electron-builder-util/out/fs"
import { readInstalled } from "./readInstalled"
export async function installOrRebuild(config: Config, appDir: string, electronVersion: string, platform: string, arch: string, forceInstall: boolean = false) {
diff --git a/packages/electron-publisher-s3/package.json b/packages/electron-publisher-s3/package.json
index 7ec600aa786..1a09fd9eaae 100644
--- a/packages/electron-publisher-s3/package.json
+++ b/packages/electron-publisher-s3/package.json
@@ -11,10 +11,10 @@
"out"
],
"dependencies": {
- "fs-extra-p": "^3.1.0",
- "aws-sdk": "^2.13.0",
+ "fs-extra-p": "^4.0.1",
+ "aws-sdk": "^2.15.0",
"mime": "^1.3.4",
- "bluebird-lst-c": "^1.0.6",
+ "bluebird-lst": "^1.0.1",
"electron-builder-publisher": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release"
},
diff --git a/packages/electron-publisher-s3/src/s3Publisher.ts b/packages/electron-publisher-s3/src/s3Publisher.ts
index 6b5a47d7ef0..02caf7e9776 100644
--- a/packages/electron-publisher-s3/src/s3Publisher.ts
+++ b/packages/electron-publisher-s3/src/s3Publisher.ts
@@ -1,11 +1,10 @@
-import { Publisher, PublishContext } from "electron-builder-publisher"
-import { S3Options } from "electron-builder-http/out/publishOptions"
import { S3 } from "aws-sdk"
+import { S3Options } from "electron-builder-http/out/publishOptions"
+import { PublishContext, Publisher } from "electron-builder-publisher"
+import { debug, isEmptyOrSpaces } from "electron-builder-util"
import { stat } from "fs-extra-p"
import mime from "mime"
-import BluebirdPromise from "bluebird-lst-c"
-import { debug, isEmptyOrSpaces } from "electron-builder-util"
-import { basename} from "path"
+import { basename } from "path"
export default class S3Publisher extends Publisher {
private readonly s3 = new S3({signatureVersion: "v4"})
@@ -29,7 +28,7 @@ export default class S3Publisher extends Publisher {
async upload(file: string, safeArtifactName?: string): Promise {
const fileName = basename(file)
const fileStat = await stat(file)
- return this.context.cancellationToken.trackPromise(new BluebirdPromise((resolve, reject, onCancel) => {
+ return this.context.cancellationToken.createPromise((resolve, reject, onCancel) => {
const upload = this.s3.upload({
Bucket: this.info.bucket!,
Key: (this.info.path == null ? "" : `${this.info.path}/`) + fileName,
@@ -48,8 +47,8 @@ export default class S3Publisher extends Publisher {
resolve()
})
- onCancel!(() => upload.abort())
- }))
+ onCancel(() => upload.abort())
+ })
}
toString() {
diff --git a/packages/electron-updater/package.json b/packages/electron-updater/package.json
index 78c2f6396fd..fdd2497cc91 100644
--- a/packages/electron-updater/package.json
+++ b/packages/electron-updater/package.json
@@ -12,8 +12,8 @@
"out"
],
"dependencies": {
- "bluebird-lst-c": "^1.0.6",
- "fs-extra-p": "^3.1.0",
+ "bluebird-lst": "^1.0.1",
+ "fs-extra-p": "^4.0.1",
"js-yaml": "^3.8.1",
"semver": "^5.3.0",
"source-map-support": "^0.4.11",
diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts
index 1e565ed3054..10c67ae1d2c 100644
--- a/packages/electron-updater/src/AppUpdater.ts
+++ b/packages/electron-updater/src/AppUpdater.ts
@@ -1,17 +1,18 @@
+import "source-map-support/register"
+import BluebirdPromise from "bluebird-lst"
+import { executorHolder, RequestHeaders } from "electron-builder-http"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
+import { BintrayOptions, GenericServerOptions, GithubOptions, PublishConfiguration, S3Options, s3Url, VersionInfo } from "electron-builder-http/out/publishOptions"
import { EventEmitter } from "events"
+import { readFile } from "fs-extra-p"
+import { safeLoad } from "js-yaml"
import * as path from "path"
import { gt as isVersionGreaterThan, valid as parseVersion } from "semver"
-import { RequestHeaders, executorHolder } from "electron-builder-http"
-import { Provider, UpdateCheckResult, FileInfo, UpdaterSignal } from "./api"
+import { FileInfo, Provider, UpdateCheckResult, UpdaterSignal } from "./api"
import { BintrayProvider } from "./BintrayProvider"
-import BluebirdPromise from "bluebird-lst-c"
-import { BintrayOptions, PublishConfiguration, GithubOptions, S3Options, GenericServerOptions, VersionInfo, s3Url } from "electron-builder-http/out/publishOptions"
-import { readFile } from "fs-extra-p"
-import { safeLoad } from "js-yaml"
+import { ElectronHttpExecutor } from "./electronHttpExecutor"
import { GenericProvider } from "./GenericProvider"
import { GitHubProvider } from "./GitHubProvider"
-import { ElectronHttpExecutor } from "./electronHttpExecutor"
-import "source-map-support/register"
export interface Logger {
info(message?: any): void
@@ -181,11 +182,13 @@ export abstract class AppUpdater extends EventEmitter {
this.onUpdateAvailable(versionInfo, fileInfo)
+ const cancellationToken = new CancellationToken()
//noinspection ES6MissingAwait
return {
versionInfo: versionInfo,
fileInfo: fileInfo,
- downloadPromise: this.autoDownload ? this.downloadUpdate() : null,
+ cancellationToken: cancellationToken,
+ downloadPromise: this.autoDownload ? this.downloadUpdate(cancellationToken) : null,
}
}
@@ -200,7 +203,7 @@ export abstract class AppUpdater extends EventEmitter {
* Start downloading update manually. You can use this method if `autoDownload` option is set to `false`.
* @returns {Promise} Path to downloaded file.
*/
- async downloadUpdate(): Promise {
+ async downloadUpdate(cancellationToken: CancellationToken = new CancellationToken()): Promise {
const versionInfo = this.versionInfo
const fileInfo = this.fileInfo
if (versionInfo == null || fileInfo == null) {
@@ -215,7 +218,7 @@ export abstract class AppUpdater extends EventEmitter {
}
try {
- return await this.doDownloadUpdate(versionInfo, fileInfo)
+ return await this.doDownloadUpdate(versionInfo, fileInfo, cancellationToken)
}
catch (e) {
this.dispatchError(e)
@@ -227,7 +230,7 @@ export abstract class AppUpdater extends EventEmitter {
this.emit("error", e, (e.stack || e).toString())
}
- protected async abstract doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo): Promise
+ protected async abstract doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo, cancellationToken: CancellationToken): Promise
abstract quitAndInstall(): void
diff --git a/packages/electron-updater/src/MacUpdater.ts b/packages/electron-updater/src/MacUpdater.ts
index fe785b6fb22..f608034f64a 100644
--- a/packages/electron-updater/src/MacUpdater.ts
+++ b/packages/electron-updater/src/MacUpdater.ts
@@ -1,7 +1,8 @@
-import { AppUpdater } from "./AppUpdater"
+import BluebirdPromise from "bluebird-lst"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
import { PublishConfiguration, VersionInfo } from "electron-builder-http/out/publishOptions"
-import BluebirdPromise from "bluebird-lst-c"
import { FileInfo } from "./api"
+import { AppUpdater } from "./AppUpdater"
import AutoUpdater = Electron.AutoUpdater
export class MacUpdater extends AppUpdater {
@@ -29,7 +30,7 @@ export class MacUpdater extends AppUpdater {
super.onUpdateAvailable(versionInfo, fileInfo)
}
- protected doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo) {
+ protected doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo, cancellationToken: CancellationToken) {
this.nativeUpdater.checkForUpdates()
return BluebirdPromise.resolve()
}
diff --git a/packages/electron-updater/src/NsisUpdater.ts b/packages/electron-updater/src/NsisUpdater.ts
index 06df6896a47..e812c157e0f 100644
--- a/packages/electron-updater/src/NsisUpdater.ts
+++ b/packages/electron-updater/src/NsisUpdater.ts
@@ -1,13 +1,13 @@
+import "source-map-support/register"
import { spawn } from "child_process"
-import * as path from "path"
-import { tmpdir } from "os"
import { download, DownloadOptions } from "electron-builder-http"
-import { DOWNLOAD_PROGRESS, FileInfo } from "./api"
+import { CancellationError, CancellationToken } from "electron-builder-http/out/CancellationToken"
import { PublishConfiguration, VersionInfo } from "electron-builder-http/out/publishOptions"
import { mkdtemp, remove } from "fs-extra-p"
-import "source-map-support/register"
+import { tmpdir } from "os"
+import * as path from "path"
+import { DOWNLOAD_PROGRESS, FileInfo } from "./api"
import { AppUpdater } from "./AppUpdater"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
export class NsisUpdater extends AppUpdater {
private setupPath: string | null
@@ -22,11 +22,11 @@ export class NsisUpdater extends AppUpdater {
* Start downloading update manually. You can use this method if `autoDownload` option is set to `false`.
* @returns {Promise} Path to downloaded file.
*/
- protected async doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo) {
+ protected async doDownloadUpdate(versionInfo: VersionInfo, fileInfo: FileInfo, cancellationToken: CancellationToken) {
const downloadOptions: DownloadOptions = {
skipDirCreation: true,
headers: this.requestHeaders || undefined,
- cancellationToken: new CancellationToken(),
+ cancellationToken: cancellationToken,
sha2: fileInfo == null ? null : fileInfo.sha2,
}
@@ -48,6 +48,12 @@ export class NsisUpdater extends AppUpdater {
// ignored
}
+ if (e instanceof CancellationError) {
+ this.emit("update-cancelled", this.versionInfo)
+ if (logger != null) {
+ logger.info("Cancelled")
+ }
+ }
throw e
}
diff --git a/packages/electron-updater/src/api.ts b/packages/electron-updater/src/api.ts
index ae7c3e590f9..7002a3aef9b 100644
--- a/packages/electron-updater/src/api.ts
+++ b/packages/electron-updater/src/api.ts
@@ -1,7 +1,8 @@
-import { VersionInfo } from "electron-builder-http/out/publishOptions"
-import { EventEmitter } from "events"
import { RequestHeaders } from "electron-builder-http"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
import { ProgressInfo } from "electron-builder-http/out/ProgressCallbackTransform"
+import { VersionInfo } from "electron-builder-http/out/publishOptions"
+import { EventEmitter } from "events"
export interface FileInfo {
readonly name: string
@@ -47,6 +48,8 @@ export interface UpdateCheckResult {
readonly fileInfo?: FileInfo
readonly downloadPromise?: Promise | null
+
+ readonly cancellationToken?: CancellationToken
}
export const DOWNLOAD_PROGRESS = "download-progress"
@@ -62,6 +65,10 @@ export class UpdaterSignal {
updateDownloaded(handler: (info: VersionInfo) => void) {
addHandler(this.emitter, "update-downloaded", handler)
}
+
+ updateCancelled(handler: (info: VersionInfo) => void) {
+ addHandler(this.emitter, "update-cancelled", handler)
+ }
}
const isLogEvent = false
diff --git a/packages/electron-updater/src/electronHttpExecutor.ts b/packages/electron-updater/src/electronHttpExecutor.ts
index 3e446b68445..6c20dd243ed 100644
--- a/packages/electron-updater/src/electronHttpExecutor.ts
+++ b/packages/electron-updater/src/electronHttpExecutor.ts
@@ -1,18 +1,17 @@
import { net } from "electron"
+import { configureRequestOptions, DownloadOptions, dumpRequestOptions, HttpExecutor } from "electron-builder-http"
+import { CancellationToken } from "electron-builder-http/out/CancellationToken"
import { ensureDir } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
import * as path from "path"
-import { HttpExecutor, DownloadOptions, dumpRequestOptions, configureRequestOptions } from "electron-builder-http"
import { parse as parseUrl } from "url"
-import { CancellationToken } from "electron-builder-http/out/CancellationToken"
export class ElectronHttpExecutor extends HttpExecutor {
- async download(url: string, destination: string, options?: DownloadOptions | null): Promise {
+ async download(url: string, destination: string, options: DownloadOptions): Promise {
if (options == null || !options.skipDirCreation) {
await ensureDir(path.dirname(destination))
}
- return await new BluebirdPromise((resolve, reject) => {
+ return await options.cancellationToken.createPromise((resolve, reject, onCancel) => {
const parsedUrl = parseUrl(url)
this.doDownload(configureRequestOptions({
@@ -20,15 +19,15 @@ export class ElectronHttpExecutor extends HttpExecutor {
+ headers: options.headers || undefined,
+ }), destination, 0, options, (error: Error) => {
if (error == null) {
resolve(destination)
}
else {
reject(error)
}
- })
+ }, onCancel)
})
}
@@ -37,7 +36,7 @@ export class ElectronHttpExecutor extends HttpExecutor((resolve, reject, onCancel) => {
+ return cancellationToken.createPromise((resolve, reject, onCancel) => {
const request = net.request(options, response => {
try {
this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor)
@@ -49,8 +48,8 @@ export class ElectronHttpExecutor extends HttpExecutor request.abort())
- }))
+ onCancel(() => request.abort())
+ })
}
diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts
index 3427da683cf..a8d8b705361 100644
--- a/test/src/BuildTest.ts
+++ b/test/src/BuildTest.ts
@@ -1,24 +1,15 @@
-import {
- assertPack,
- modifyPackageJson,
- getPossiblePlatforms,
- app,
- appThrows,
- packageJson,
- appTwoThrows,
- allPlatforms
-} from "./helpers/packTester"
+import { extractFile } from "asar-electron-builder"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, BuildOptions, DIR_TARGET, PackagerOptions, Platform } from "electron-builder"
+import { build, normalizeOptions } from "electron-builder/out/builder"
+import { createYargs } from "electron-builder/out/cli/cliOptions"
+import { checkWineVersion } from "electron-builder/out/packager"
import { move, outputJson } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
+import isCi from "is-ci"
import * as path from "path"
-import { assertThat } from "./helpers/fileAssert"
-import { BuildOptions, Platform, PackagerOptions, DIR_TARGET, Arch } from "electron-builder"
-import { normalizeOptions, build } from "electron-builder/out/builder"
-import { createYargs } from "electron-builder/out/cli/cliOptions"
-import { extractFile } from "asar-electron-builder"
import { ELECTRON_VERSION } from "./helpers/config"
-import isCi from "is-ci"
-import { checkWineVersion } from "electron-builder/out/packager"
+import { assertThat } from "./helpers/fileAssert"
+import { allPlatforms, app, appThrows, appTwoThrows, assertPack, getPossiblePlatforms, modifyPackageJson, packageJson } from "./helpers/packTester"
test("cli", async () => {
const yargs = createYargs()
diff --git a/test/src/filesTest.ts b/test/src/filesTest.ts
index 95b533176ad..7354c0cead8 100644
--- a/test/src/filesTest.ts
+++ b/test/src/filesTest.ts
@@ -1,15 +1,14 @@
-import { expectedWinContents } from "./helpers/expectedContents"
-import { outputFile, stat, symlink, readFile } from "fs-extra-p"
-import { assertPack, app } from "./helpers/packTester"
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
+import { DIR_TARGET, Platform } from "electron-builder"
+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 { assertThat } from "./helpers/fileAssert"
-import { Platform, DIR_TARGET } from "electron-builder"
import pathSorter from "path-sort"
-import Mode from "stat-mode"
-import { Permissions } from "stat-mode"
-import { TmpDir } from "electron-builder-util/out/tmp"
-import { copyDir } from "electron-builder-util/out/fs"
+import Mode, { Permissions } from "stat-mode"
+import { expectedWinContents } from "./helpers/expectedContents"
+import { assertThat } from "./helpers/fileAssert"
+import { app, assertPack } from "./helpers/packTester"
test.ifDevOrLinuxCi("files", app({
targets: Platform.LINUX.createTarget(DIR_TARGET),
diff --git a/test/src/globTest.ts b/test/src/globTest.ts
index 26ad937fa9a..3e2acc0f744 100644
--- a/test/src/globTest.ts
+++ b/test/src/globTest.ts
@@ -1,10 +1,10 @@
-import { outputFile, symlink, writeFile, mkdirs } from "fs-extra-p"
-import { assertPack, modifyPackageJson, app, PackedContext, getTempFile } from "./helpers/packTester"
-import BluebirdPromise from "bluebird-lst-c"
+import { statFile } from "asar-electron-builder"
+import BluebirdPromise from "bluebird-lst"
+import { DIR_TARGET, Platform } from "electron-builder"
+import { mkdirs, outputFile, symlink, writeFile } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "./helpers/fileAssert"
-import { Platform, DIR_TARGET } from "electron-builder"
-import { statFile } from "asar-electron-builder"
+import { app, assertPack, getTempFile, modifyPackageJson, PackedContext } from "./helpers/packTester"
async function createFiles(appDir: string) {
await BluebirdPromise.all([
diff --git a/test/src/helpers/checkDeps.ts b/test/src/helpers/checkDeps.ts
index 0b8ac90b739..75526b9f0f0 100644
--- a/test/src/helpers/checkDeps.ts
+++ b/test/src/helpers/checkDeps.ts
@@ -1,8 +1,8 @@
-import * as path from "path"
-import { readJson, readdir } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
-import depCheck, { DepCheckResult } from "depcheck"
+import BluebirdPromise from "bluebird-lst"
import { bold } from "chalk"
+import depCheck, { DepCheckResult } from "depcheck"
+import { readdir, readJson } from "fs-extra-p"
+import * as path from "path"
const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit
diff --git a/test/src/helpers/lint.ts b/test/src/helpers/lint.ts
index 9170a207230..a2f6be4cfb4 100644
--- a/test/src/helpers/lint.ts
+++ b/test/src/helpers/lint.ts
@@ -1,7 +1,7 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { readdir } from "fs-extra-p"
-import * as path from "path"
import { cpus } from "os"
+import * as path from "path"
const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit
const spawn = require("../../../packages/electron-builder-util/out/util").spawn
diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts
index eac845b3a10..a94a76d6c07 100755
--- a/test/src/helpers/runTests.ts
+++ b/test/src/helpers/runTests.ts
@@ -1,11 +1,11 @@
-import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
-import { emptyDir, readdir, unlink, removeSync, readJson } from "fs-extra-p"
-import { homedir } from "os"
-import { TEST_DIR, ELECTRON_VERSION } from "./config"
+import BluebirdPromise from "bluebird-lst"
+import { emptyDir, readdir, readJson, removeSync, unlink } from "fs-extra-p"
import isCi from "is-ci"
+import { homedir } from "os"
+import * as path from "path"
+import { ELECTRON_VERSION, TEST_DIR } from "./config"
-// we set NODE_PATH in this file, so, we cannot use 'out/awaiter' path here
+// we set NODE_PATH in this file, so, we cannot use 'out/util' path here
const util = require("../../../packages/electron-builder-util/out/util")
const isEmptyOrSpaces = util.isEmptyOrSpaces
diff --git a/test/src/helpers/setVersions.ts b/test/src/helpers/setVersions.ts
index 3dda9fe1c06..93f7ad0abb3 100644
--- a/test/src/helpers/setVersions.ts
+++ b/test/src/helpers/setVersions.ts
@@ -1,6 +1,6 @@
-import * as path from "path"
+import BluebirdPromise from "bluebird-lst"
import { readdir, readJson, writeJson } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
+import * as path from "path"
import * as semver from "semver"
const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit
diff --git a/test/src/helpers/winHelper.ts b/test/src/helpers/winHelper.ts
index 6aa29a04e5b..9581e2d61b7 100644
--- a/test/src/helpers/winHelper.ts
+++ b/test/src/helpers/winHelper.ts
@@ -1,13 +1,13 @@
+import { extractFile } from "asar-electron-builder"
+import BluebirdPromise from "bluebird-lst"
import { Arch, Platform } from "electron-builder-core"
+import { walk } from "electron-builder-util/out/fs"
+import { outputFile, readFile } from "fs-extra-p"
import { safeLoad } from "js-yaml"
-import { PackedContext } from "./packTester"
-import { readFile, outputFile } from "fs-extra-p"
import * as path from "path"
-import { diff, WineManager } from "./wine"
-import { walk } from "electron-builder-util/out/fs"
-import { extractFile } from "asar-electron-builder"
-import BluebirdPromise from "bluebird-lst-c"
import { assertThat } from "./fileAssert"
+import { PackedContext } from "./packTester"
+import { diff, WineManager } from "./wine"
export async function expectUpdateMetadata(context: PackedContext, arch: Arch = Arch.ia32, requireCodeSign: boolean = false): Promise {
const data = safeLoad(await readFile(path.join(context.getResources(Platform.WINDOWS, arch), "app-update.yml"), "utf-8"))
diff --git a/test/src/helpers/wine.ts b/test/src/helpers/wine.ts
index 3e4d04ab8be..cfba30c1c4a 100644
--- a/test/src/helpers/wine.ts
+++ b/test/src/helpers/wine.ts
@@ -1,10 +1,10 @@
+import BluebirdPromise from "bluebird-lst"
import { exec } from "electron-builder-util"
+import { unlinkIfExists } from "electron-builder-util/out/fs"
+import { emptyDir, ensureDir, readFile, writeFile } from "fs-extra-p"
import { homedir } from "os"
-import { emptyDir, readFile, writeFile, ensureDir } from "fs-extra-p"
import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
import pathSorter from "path-sort"
-import { unlinkIfExists } from "electron-builder-util/out/fs"
export class WineManager {
wineDir: string
diff --git a/test/src/ignoreTest.ts b/test/src/ignoreTest.ts
index b2ff7fb4a19..726bb0f79d3 100644
--- a/test/src/ignoreTest.ts
+++ b/test/src/ignoreTest.ts
@@ -1,9 +1,9 @@
+import BluebirdPromise from "bluebird-lst"
+import { DIR_TARGET, Platform } from "electron-builder"
import { outputFile } from "fs-extra-p"
-import { assertPack, modifyPackageJson, app } from "./helpers/packTester"
-import BluebirdPromise from "bluebird-lst-c"
import * as path from "path"
import { assertThat } from "./helpers/fileAssert"
-import { Platform, DIR_TARGET } from "electron-builder"
+import { app, assertPack, modifyPackageJson } from "./helpers/packTester"
test.ifDevOrLinuxCi("ignore build resources", app({
targets: Platform.LINUX.createTarget(DIR_TARGET),
diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts
index e213c8b6136..5384c7c5e0e 100644
--- a/test/src/mac/dmgTest.ts
+++ b/test/src/mac/dmgTest.ts
@@ -1,10 +1,10 @@
-import { assertPack, app, CheckingMacPackager } from "../helpers/packTester"
-import { remove, copy } from "fs-extra-p"
-import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
-import { assertThat } from "../helpers/fileAssert"
+import BluebirdPromise from "bluebird-lst"
import { Platform } from "electron-builder"
import { attachAndExecute } from "electron-builder/out/targets/dmg"
+import { copy, remove } from "fs-extra-p"
+import * as path from "path"
+import { assertThat } from "../helpers/fileAssert"
+import { app, assertPack, CheckingMacPackager } from "../helpers/packTester"
test.ifMac("no build directory", app({
targets: Platform.MAC.createTarget("dmg"),
diff --git a/test/src/mac/macArchiveTest.ts b/test/src/mac/macArchiveTest.ts
index f9a0c9a3a0c..99717ab3c17 100644
--- a/test/src/mac/macArchiveTest.ts
+++ b/test/src/mac/macArchiveTest.ts
@@ -1,12 +1,12 @@
-import { app, createMacTargetTest, getFixtureDir, parseFileList } from "../helpers/packTester"
-import { assertThat } from "../helpers/fileAssert"
+import BluebirdPromise from "bluebird-lst"
import { Platform } from "electron-builder-core"
import { exec } from "electron-builder-util"
+import { readFile, symlink } from "fs-extra-p"
import * as path from "path"
import pathSorter from "path-sort"
-import { readFile, symlink } from "fs-extra-p"
import { parseString } from "xml2js"
-import BluebirdPromise from "bluebird-lst-c"
+import { assertThat } from "../helpers/fileAssert"
+import { app, createMacTargetTest, getFixtureDir, parseFileList } from "../helpers/packTester"
test.ifMac("invalid target", () => assertThat(createMacTargetTest(["ttt"])()).throws("Unknown target: ttt"))
diff --git a/test/src/mac/macPackagerTest.ts b/test/src/mac/macPackagerTest.ts
index 73cca27b958..9fae5c285f7 100644
--- a/test/src/mac/macPackagerTest.ts
+++ b/test/src/mac/macPackagerTest.ts
@@ -1,3 +1,4 @@
+import BluebirdPromise from "bluebird-lst"
import { createTargets, Platform } from "electron-builder"
import { copyFile } from "electron-builder-util/out/fs"
import { DIR_TARGET } from "electron-builder/out/targets/targetFactory"
@@ -5,7 +6,6 @@ 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"
-import BluebirdPromise from "bluebird-lst-c"
test.ifMac("two-package", () => assertPack("test-app", {targets: createTargets([Platform.MAC], null, "all")}, {signed: true, useTempDir: true}))
diff --git a/test/src/mac/masTest.ts b/test/src/mac/masTest.ts
index 557a71136f4..36f4c65537a 100644
--- a/test/src/mac/masTest.ts
+++ b/test/src/mac/masTest.ts
@@ -1,8 +1,8 @@
-import { assertPack, signed, CheckingMacPackager, createMacTargetTest } from "../helpers/packTester"
+import BluebirdPromise from "bluebird-lst"
+import { Platform } from "electron-builder"
import { writeFile } from "fs-extra-p"
import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
-import { Platform } from "electron-builder"
+import { assertPack, CheckingMacPackager, createMacTargetTest, signed } from "../helpers/packTester"
if (process.platform !== "darwin") {
fit("Skip mas tests because platform is not macOS", () => {
diff --git a/test/src/mainEntryTest.ts b/test/src/mainEntryTest.ts
index aba8f0b9a11..9101706c257 100644
--- a/test/src/mainEntryTest.ts
+++ b/test/src/mainEntryTest.ts
@@ -1,7 +1,7 @@
-import { assertPack, modifyPackageJson, appTwoThrows, allPlatforms } from "./helpers/packTester"
+import BluebirdPromise from "bluebird-lst"
import { move } from "fs-extra-p"
-import BluebirdPromise from "bluebird-lst-c"
import * as path from "path"
+import { allPlatforms, appTwoThrows, assertPack, modifyPackageJson } from "./helpers/packTester"
test("invalid main in the app package.json", appTwoThrows(/Application entry file "main.js" in the /, allPlatforms(false), {
projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
diff --git a/test/src/nsisUpdaterTest.ts b/test/src/nsisUpdaterTest.ts
index 245b643cac8..1c3b231fcf0 100644
--- a/test/src/nsisUpdaterTest.ts
+++ b/test/src/nsisUpdaterTest.ts
@@ -1,10 +1,11 @@
-import { assertThat } from "./helpers/fileAssert"
-import { NsisUpdater } from "electron-updater/out/NsisUpdater"
-import * as path from "path"
+import BluebirdPromise from "bluebird-lst"
+import { BintrayOptions, GenericServerOptions, GithubOptions } from "electron-builder-http/out/publishOptions"
import { TmpDir } from "electron-builder-util/out/tmp"
+import { NsisUpdater } from "electron-updater/out/NsisUpdater"
import { outputFile } from "fs-extra-p"
import { safeDump } from "js-yaml"
-import { GenericServerOptions, GithubOptions, BintrayOptions } from "electron-builder-http/out/publishOptions"
+import * as path from "path"
+import { assertThat } from "./helpers/fileAssert"
if (process.env.ELECTRON_BUILDER_OFFLINE === "true") {
fit("Skip ArtifactPublisherTest suite — ELECTRON_BUILDER_OFFLINE is defined", () => {
@@ -199,6 +200,34 @@ test("test download progress", async () => {
expect(lastEvent.transferred).toBe(lastEvent.total)
})
+test("cancel download with progress", async () => {
+ const updater = new NsisUpdater()
+ updater.updateConfigPath = await writeUpdateConfig({
+ provider: "generic",
+ url: "https://develar.s3.amazonaws.com/full-test",
+ })
+
+ const progressEvents: Array = []
+ updater.signals.progress(it => progressEvents.push(it))
+
+ let cancelled = false
+ updater.signals.updateCancelled(() => cancelled = true)
+
+ const checkResult = await updater.checkForUpdates()
+ checkResult.cancellationToken.cancel()
+
+ if (progressEvents.length > 0) {
+ const lastEvent = progressEvents[progressEvents.length - 1]
+ expect(lastEvent.percent).not.toBe(100)
+ expect(lastEvent.bytesPerSecond).toBeGreaterThan(1)
+ expect(lastEvent.transferred).not.toBe(lastEvent.total)
+ }
+
+ const downloadPromise = >checkResult.downloadPromise
+ await assertThat(downloadPromise).throws("Cancelled")
+ expect(downloadPromise.isRejected()).toBe(true)
+ expect(cancelled).toBe(true)
+})
async function writeUpdateConfig(data: GenericServerOptions | GithubOptions | BintrayOptions): Promise {
const updateConfigPath = path.join(await tmpDir.getTempFile("update-config"), "app-update.yml")
diff --git a/test/src/windows/oneClickInstallerTest.ts b/test/src/windows/oneClickInstallerTest.ts
index f8692b1f790..cd3db47ef70 100644
--- a/test/src/windows/oneClickInstallerTest.ts
+++ b/test/src/windows/oneClickInstallerTest.ts
@@ -1,4 +1,4 @@
-import BluebirdPromise from "bluebird-lst-c"
+import BluebirdPromise from "bluebird-lst"
import { Arch, Platform } from "electron-builder"
import { readFile } from "fs-extra-p"
import { safeLoad } from "js-yaml"
diff --git a/test/src/windows/squirrelWindowsTest.ts b/test/src/windows/squirrelWindowsTest.ts
index 1de04e7d6aa..37bb30befc4 100644
--- a/test/src/windows/squirrelWindowsTest.ts
+++ b/test/src/windows/squirrelWindowsTest.ts
@@ -1,7 +1,7 @@
-import { Platform, Arch } from "electron-builder"
-import { app, modifyPackageJson, assertPack, CheckingWinPackager, copyTestAsset } from "../helpers/packTester"
+import BluebirdPromise from "bluebird-lst"
+import { Arch, Platform } from "electron-builder"
import * as path from "path"
-import BluebirdPromise from "bluebird-lst-c"
+import { app, assertPack, CheckingWinPackager, copyTestAsset, modifyPackageJson } from "../helpers/packTester"
test.ifNotCiMac("Squirrel.Windows", app({targets: Platform.WINDOWS.createTarget(["squirrel", "zip"])}, {signed: true}))
diff --git a/test/tsconfig.json b/test/tsconfig.json
index b3c86ebdc22..219b227b424 100755
--- a/test/tsconfig.json
+++ b/test/tsconfig.json
@@ -17,7 +17,7 @@
"files": [
"../node_modules/@types/jest/index.d.ts",
"../node_modules/fs-extra-p/index.d.ts",
- "../node_modules/bluebird-lst-c/index.d.ts",
+ "../node_modules/bluebird-lst/index.d.ts",
"../node_modules/electron-macos-sign/index.d.ts"
],
"include": [
diff --git a/yarn.lock b/yarn.lock
index ac49bb9cd19..afea279b806 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -213,9 +213,9 @@ asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
-aws-sdk@^2.13.0:
- version "2.13.0"
- resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.13.0.tgz#bfaf9b8375563f909ea74b200ade2458aa7fde85"
+aws-sdk@^2.15.0:
+ version "2.15.0"
+ resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.15.0.tgz#dca391a793210d4b062b5f1f5d6bb25bc4d4ba5c"
dependencies:
buffer "4.9.1"
crypto-browserify "1.0.9"
@@ -243,7 +243,7 @@ babel-code-frame@^6.20.0, babel-code-frame@^6.22.0:
esutils "^2.0.2"
js-tokens "^3.0.0"
-babel-core@^6.0.0, babel-core@^6.22.1, babel-core@^6.23.0:
+babel-core@^6.0.0, babel-core@^6.23.0, babel-core@^6.23.1:
version "6.23.1"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.23.1.tgz#c143cb621bb2f621710c220c5d579d15b8a442df"
dependencies:
@@ -506,6 +506,12 @@ bluebird-lst-c@^1.0.6:
dependencies:
bluebird "^3.4.7"
+bluebird-lst@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/bluebird-lst/-/bluebird-lst-1.0.1.tgz#2b666b20bb1c1902e6b7b352d9c0fbf56830b5a3"
+ dependencies:
+ bluebird "^3.4.7"
+
bluebird@^3.4.7:
version "3.4.7"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3"
@@ -1191,11 +1197,11 @@ form-data@~2.1.1:
combined-stream "^1.0.5"
mime-types "^2.1.12"
-fs-extra-p@^3.1.0:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/fs-extra-p/-/fs-extra-p-3.1.0.tgz#eddf7bb8d9385d79014decb21f45b1d0c57900d3"
+fs-extra-p@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/fs-extra-p/-/fs-extra-p-4.0.1.tgz#b18398c20a3822ae2b5ef682800f3d2bdedba77b"
dependencies:
- bluebird-lst-c "^1.0.6"
+ bluebird-lst "^1.0.1"
fs-extra "^2.0.0"
fs-extra@^2.0.0:
@@ -1272,8 +1278,8 @@ glob@~5.0.0:
path-is-absolute "^1.0.0"
globals@^9.0.0:
- version "9.15.0"
- resolved "https://registry.yarnpkg.com/globals/-/globals-9.15.0.tgz#7a5d8fd865e69de910b090b15a87772f9423c5de"
+ version "9.16.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80"
got@^5.0.0:
version "5.7.1"
@@ -2148,9 +2154,9 @@ map-obj@^1.0.0, map-obj@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
-markdown-it@^8.2.2:
- version "8.2.2"
- resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.2.2.tgz#e39593d976f9c4b7ee7f338a3a1e9e10c3db4e36"
+markdown-it@^8.3.0:
+ version "8.3.0"
+ resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.3.0.tgz#3d7a727a100cd24e276419c66da20ffbe28c3602"
dependencies:
argparse "^1.0.7"
entities "~1.1.1"
@@ -2598,8 +2604,8 @@ q@^1.1.2:
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
qs@~6.3.0:
- version "6.3.0"
- resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442"
+ version "6.3.1"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.1.tgz#918c0b3bcd36679772baf135b1acb4c1651ed79d"
querystring@0.2.0:
version "0.2.0"
@@ -2613,13 +2619,13 @@ randomatic@^1.1.3:
kind-of "^3.0.2"
rc@^1.0.1, rc@^1.1.6:
- version "1.1.6"
- resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9"
+ version "1.1.7"
+ resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea"
dependencies:
deep-extend "~0.4.0"
ini "~1.3.0"
minimist "^1.2.0"
- strip-json-comments "~1.0.4"
+ strip-json-comments "~2.0.1"
read-all-stream@^3.0.0:
version "3.1.0"
@@ -2981,9 +2987,9 @@ strip-indent@^1.0.1:
dependencies:
get-stdin "^4.0.1"
-strip-json-comments@~1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91"
+strip-json-comments@~2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
sumchecker@^2.0.1:
version "2.0.1"
@@ -3109,15 +3115,15 @@ truncate-utf8-bytes@^1.0.0:
dependencies:
utf8-byte-length "^1.0.1"
-ts-babel@^1.3.6:
- version "1.3.6"
- resolved "https://registry.yarnpkg.com/ts-babel/-/ts-babel-1.3.6.tgz#c98e4e480dc5cf5216798a5a8e62f268ec6adfe2"
+ts-babel@^1.3.7:
+ version "1.3.7"
+ resolved "https://registry.yarnpkg.com/ts-babel/-/ts-babel-1.3.7.tgz#2e2bf74225461d45ba0ff3e4fd601dd7ee4fe9e2"
dependencies:
- babel-core "^6.22.1"
+ babel-core "^6.23.1"
bluebird-lst-c "^1.0.6"
chalk "^1.1.3"
- fs-extra-p "^3.1.0"
- markdown-it "^8.2.2"
+ fs-extra-p "^4.0.1"
+ markdown-it "^8.3.0"
source-map-support "^0.4.11"
tslint@^4.4.2:
@@ -3298,8 +3304,8 @@ whatwg-encoding@^1.0.1:
iconv-lite "0.4.13"
whatwg-url@^4.3.0:
- version "4.3.0"
- resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.3.0.tgz#92aaee21f4f2a642074357d70ef8500a7cbb171a"
+ version "4.4.0"
+ resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.4.0.tgz#594f95781545c13934a62db40897c818cafa2e04"
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"