From d238635c8eec3a52a1397f5bf9a1a3a86babe42f Mon Sep 17 00:00:00 2001 From: develar Date: Mon, 17 Oct 2016 07:48:21 +0200 Subject: [PATCH] feat: Code signing for windows and mac in macOS Closes #822 --- nsis-auto-updater/package.json | 10 ++-------- nsis-auto-updater/yarn.lock | 10 ++++++++++ package.json | 2 +- src/publish/gitHubPublisher.ts | 4 +++- src/winPackager.ts | 24 +++++++++++++----------- yarn.lock | 8 ++++---- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/nsis-auto-updater/package.json b/nsis-auto-updater/package.json index 1c357e3d1bf..e5f7d112289 100644 --- a/nsis-auto-updater/package.json +++ b/nsis-auto-updater/package.json @@ -1,6 +1,6 @@ { "name": "electron-auto-updater", - "version": "0.0.2", + "version": "0.0.3", "description": "NSIS Auto Updater", "main": "out/nsis-auto-updater/src/main.js", "author": "Vladimir Krivosheev", @@ -16,14 +16,8 @@ "fs-extra-p": "^1.1.10", "ini": "^1.3.4", "semver": "^5.3.0", + "source-map-support": "^0.4.4", "tunnel-agent": "^0.4.3" }, - "bundledDependencies": [ - "bluebird", - "fs-extra-p", - "ini", - "semver", - "tunnel-agent" - ], "typings": "./out/electron-auto-updater.d.ts" } diff --git a/nsis-auto-updater/yarn.lock b/nsis-auto-updater/yarn.lock index 16c96fab796..bfc93065aea 100644 --- a/nsis-auto-updater/yarn.lock +++ b/nsis-auto-updater/yarn.lock @@ -106,6 +106,16 @@ semver@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" +source-map-support: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.4.tgz#0df5765a05a560c91bc8f8641cf79f2affc0322e" + dependencies: + source-map "^0.5.3" + +source-map@^0.5.3: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + tunnel-agent@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" diff --git a/package.json b/package.json index fc171cc1870..48bb5daa23d 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "read-installed": "^4.0.3", "sanitize-filename": "^1.6.1", "semver": "^5.3.0", - "source-map-support": "^0.4.3", + "source-map-support": "^0.4.4", "tunnel-agent": "^0.4.3", "update-notifier": "^1.0.2", "uuid-1345": "^0.99.6", diff --git a/src/publish/gitHubPublisher.ts b/src/publish/gitHubPublisher.ts index 20972898dcc..a73584dbd5a 100644 --- a/src/publish/gitHubPublisher.ts +++ b/src/publish/gitHubPublisher.ts @@ -45,7 +45,9 @@ export class GitHubPublisher implements Publisher { let token = info.token if (isEmptyOrSpaces(token)) { token = process.env.GH_TOKEN - throw new Error(`GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"`) + if (isEmptyOrSpaces(token)) { + throw new Error(`GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"`) + } } this.token = token! diff --git a/src/winPackager.ts b/src/winPackager.ts index 5aa10c15b46..b3fd0b3dd24 100644 --- a/src/winPackager.ts +++ b/src/winPackager.ts @@ -34,7 +34,6 @@ export class WinPackager extends PlatformPackager { const subjectName = this.platformSpecificBuildOptions.certificateSubjectName if (subjectName == null) { const certificateFile = this.platformSpecificBuildOptions.certificateFile - const cscLink = this.options.cscLink if (certificateFile != null) { const certificatePassword = this.platformSpecificBuildOptions.certificatePassword || this.getCscPassword() this.cscInfo = BluebirdPromise.resolve({ @@ -42,17 +41,20 @@ export class WinPackager extends PlatformPackager { password: certificatePassword == null ? null : certificatePassword.trim(), }) } - else if (cscLink != null) { - this.cscInfo = downloadCertificate(cscLink, info.tempDirManager) - .then(path => { - return { - file: path, - password: this.getCscPassword(), - } - }) - } else { - this.cscInfo = BluebirdPromise.resolve(null) + const cscLink = process.env.WIN_CSC_LINK || this.options.cscLink + if (cscLink != null) { + this.cscInfo = downloadCertificate(cscLink, info.tempDirManager) + .then(path => { + return { + file: path, + password: this.getCscPassword(), + } + }) + } + else { + this.cscInfo = BluebirdPromise.resolve(null) + } } } else { diff --git a/yarn.lock b/yarn.lock index d1bb66287a9..06470ac4334 100644 --- a/yarn.lock +++ b/yarn.lock @@ -267,8 +267,8 @@ async-each@^1.0.0: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" async@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/async/-/async-2.1.1.tgz#e11b6d10043f2254efb61a21163d840ccddb8d28" + version "2.1.2" + resolved "https://registry.yarnpkg.com/async/-/async-2.1.2.tgz#612a4ab45ef42a70cde806bad86ee6db047e8385" dependencies: lodash "^4.14.0" @@ -3943,8 +3943,8 @@ yargs-parser@^4.0.2: camelcase "^3.0.0" yargs@^6.0.0: - version "6.1.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.1.1.tgz#95968cdd9bda89d973215b43969b2c82ce0c8032" + version "6.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.2.0.tgz#9001048953def85495a2ce1dcfa690b7ab060fd1" dependencies: camelcase "^3.0.0" cliui "^3.2.0"