diff --git a/package.json b/package.json index 5157bc20e13..7c0366c5ef2 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "path-sort": "^0.1.0", "source-map-support": "^0.4.14", "ts-babel": "^3.0.0", - "tslint": "^4.5.1", + "tslint": "^5.0.0", "typescript": "^2.2.2", "typescript-json-schema": "0.11.0", "whitespace": "^2.1.0", diff --git a/packages/electron-builder/src/util/readPackageJson.ts b/packages/electron-builder/src/util/readPackageJson.ts index 50972850a5c..6a3ecb7b20c 100644 --- a/packages/electron-builder/src/util/readPackageJson.ts +++ b/packages/electron-builder/src/util/readPackageJson.ts @@ -1,4 +1,5 @@ import Ajv from "ajv" +import { debug } from "electron-builder-util" import { log, warn } from "electron-builder-util/out/log" import { readFile, readJson } from "fs-extra-p" import { safeLoad } from "js-yaml" @@ -148,7 +149,8 @@ export async function validateConfig(config: Config) { const validator = await validatorPromise if (!validator(config)) { - throw new Error("Config is invalid:\n" + JSON.stringify(normaliseErrorMessages(validator.errors!), null, 2) + "\n\nRaw validation errors: " + JSON.stringify(validator.errors, null, 2)) + debug(JSON.stringify(validator.errors, null, 2)) + throw new Error("Config is invalid:\n" + JSON.stringify(normaliseErrorMessages(validator.errors!), null, 2)) } } diff --git a/packages/electron-builder/src/winPackager.ts b/packages/electron-builder/src/winPackager.ts index a140659a9bf..81e3efde76f 100644 --- a/packages/electron-builder/src/winPackager.ts +++ b/packages/electron-builder/src/winPackager.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" import { DIR_TARGET, Platform, Target } from "electron-builder-core" import { asArray, exec, Lazy, use } from "electron-builder-util" -import { log } from "electron-builder-util/out/log" +import { log, warn } from "electron-builder-util/out/log" import { close, open, read, readFile, rename } from "fs-extra-p" import * as forge from "node-forge" import * as path from "path" @@ -196,8 +196,22 @@ export class WinPackager extends PlatformPackager { } //noinspection JSMethodCanBeStatic - protected doSign(options: SignOptions): Promise { - return sign(options) + protected async doSign(options: SignOptions) { + for (let i = 0; i < 3; i++) { + try { + await sign(options) + break + } + catch (e) { + // https://github.com/electron-userland/electron-builder/issues/1414 + const message = e.message + if (message != null && message.includes("Couldn't resolve host name")) { + warn(`Cannot sign, attempt ${i + 1}: ${message}`) + continue + } + throw e + } + } } async signAndEditResources(file: string) { diff --git a/packages/electron-builder/src/windowsCodeSign.ts b/packages/electron-builder/src/windowsCodeSign.ts index 291111a40e2..41551cecf16 100644 --- a/packages/electron-builder/src/windowsCodeSign.ts +++ b/packages/electron-builder/src/windowsCodeSign.ts @@ -136,20 +136,6 @@ async function spawnSign(options: SignOptions, inputPath: string, outputPath: st return await exec(await getToolPath(), args) } -// async function verify(options: any) { -// const out = await exec(await getToolPath(options), [ -// "verify", -// "-in", options.path, -// "-require-leaf-hash", options.hash -// ]) -// if (out.includes("No signature found.")) { -// throw new Error("No signature found") -// } -// else if (out.includes("Leaf hash match: failed")) { -// throw new Error("Leaf hash match failed") -// } -// } - function getOutputPath(inputPath: string, hash: string) { const extension = path.extname(inputPath) return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`) diff --git a/packages/lint.js b/packages/lint.js index a2ed3d5d6bc..9fe5ccd4fc2 100644 --- a/packages/lint.js +++ b/packages/lint.js @@ -1,9 +1,9 @@ "use strict" -const { Linter } = require("tslint") +const { Linter, Configuration } = require("tslint") const path = require("path") -const configuration = { +const configuration = Configuration.parseConfigFile({ "extends": "tslint:latest", "rules": { "no-invalid-this": [true], @@ -60,7 +60,8 @@ const configuration = { "jsdoc-format": false, "no-for-in-array": true, } -} +}) + const options = { formatter: "stylish", } diff --git a/yarn.lock b/yarn.lock index 6d65f2bd83f..38ad09f0d3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -293,7 +293,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.20.0, babel-code-frame@^6.22.0: +babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: @@ -1011,7 +1011,7 @@ detect-newline@^1.0.3: get-stdin "^4.0.1" minimist "^1.1.0" -diff@^3.0.0, diff@^3.0.1: +diff@^3.0.0, diff@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" @@ -2781,7 +2781,7 @@ resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.1.7, resolve@^1.2.0: +resolve@^1.2.0, resolve@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" dependencies: @@ -3179,21 +3179,21 @@ ts-jsdoc@^1.2.1: fs-extra-p "^4.1.0" source-map-support "^0.4.14" -tslint@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-4.5.1.tgz#05356871bef23a434906734006fc188336ba824b" +tslint@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.0.0.tgz#ad3b7952f8a9b21079248bee01c2eaf92167e185" dependencies: - babel-code-frame "^6.20.0" + babel-code-frame "^6.22.0" colors "^1.1.2" - diff "^3.0.1" + diff "^3.2.0" findup-sync "~0.3.0" glob "^7.1.1" optimist "~0.6.0" - resolve "^1.1.7" - tsutils "^1.1.0" - update-notifier "^2.0.0" + resolve "^1.3.2" + semver "^5.3.0" + tsutils "^1.4.0" -tsutils@^1.1.0: +tsutils@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.4.0.tgz#84f8a83df9967d35bf1ff3aa48c7339593d64e19" @@ -3279,7 +3279,7 @@ unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" -update-notifier@^2.0.0, update-notifier@^2.1.0: +update-notifier@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.1.0.tgz#ec0c1e53536b76647a24b77cb83966d9315123d9" dependencies: