diff --git a/package.json b/package.json index 2ac68e5ff64..1de163f1393 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "chromium-pickle-js": "^0.2.0", "cuint": "^0.2.2", "debug": "^2.6.3", - "electron-download-tf": "4.1.1", + "@electron-builder/electron-download": "4.2.1", "electron-osx-sign": "0.4.4", "fs-extra-p": "^4.1.0", "hosted-git-info": "^2.4.1", diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json index f639752b0d3..44eecf0a94d 100644 --- a/packages/electron-builder/package.json +++ b/packages/electron-builder/package.json @@ -54,7 +54,7 @@ "electron-builder-core": "0.0.0-semantic-release", "electron-builder-http": "0.0.0-semantic-release", "electron-builder-util": "0.0.0-semantic-release", - "electron-download-tf": "4.1.1", + "@electron-builder/electron-download": "4.2.1", "electron-osx-sign": "0.4.4", "electron-publish": "0.0.0-semantic-release", "fs-extra-p": "^4.1.0", diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts index 74ee48aa594..78581556730 100644 --- a/packages/electron-builder/src/packager/dirPackager.ts +++ b/packages/electron-builder/src/packager/dirPackager.ts @@ -7,7 +7,7 @@ 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")) +const downloadElectron: (options: any) => Promise = BluebirdPromise.promisify(require("@electron-builder/electron-download")) function createDownloadOpts(opts: any, platform: string, arch: string, electronVersion: string) { if (opts.download != null) { diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts index cf70a85a778..870804baeb5 100644 --- a/packages/electron-builder/src/targets/nsis.ts +++ b/packages/electron-builder/src/targets/nsis.ts @@ -4,7 +4,7 @@ import { asArray, debug, doSpawn, exec, getPlatformIconFileName, handleProcess, 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 { outputFile, readFile, unlink } from "fs-extra-p" import { safeLoad } from "js-yaml" import * as path from "path" import sanitizeFileName from "sanitize-filename" @@ -407,6 +407,12 @@ export class NsisTarget extends Target { }) } + private async writeCustomLangFile(data: string) { + const file = await this.packager.getTempFile("messages.nsh") + await outputFile(file, data) + return file + } + private async computeFinalScript(originalScript: string, isInstaller: boolean) { const packager = this.packager let scriptHeader = `!addincludedir "${path.win32.join(__dirname, "..", "..", "templates", "nsis", "include")}"\n` @@ -421,14 +427,18 @@ export class NsisTarget extends Target { scriptHeader += createMacro("licensePage", licensePage) } - scriptHeader += "\n" + computeCustomMessageTranslations(safeLoad(await readFile(path.join(this.nsisTemplatesDir, "messages.yml"), "utf-8"))).join("\n") + "\n\n" + const addCustomMessageFileInclude = async (input: string) => { + scriptHeader += "!include " + await this.writeCustomLangFile(computeCustomMessageTranslations(safeLoad(await readFile(path.join(this.nsisTemplatesDir, input), "utf-8"))).join("\n")) + "\n" + } + + await addCustomMessageFileInclude("messages.yml") if (this.isPortable) { return scriptHeader + originalScript } if (this.options.oneClick === false) { - scriptHeader += "\n" + computeCustomMessageTranslations(safeLoad(await readFile(path.join(this.nsisTemplatesDir, "boringMessages.yml"), "utf-8"))).join("\n") + "\n\n" + await addCustomMessageFileInclude("boringMessages.yml") } const customInclude = await packager.getResource(this.options.include, "installer.nsh") diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts index 6959badb4ba..41f92e3701d 100755 --- a/test/src/helpers/runTests.ts +++ b/test/src/helpers/runTests.ts @@ -9,7 +9,7 @@ import { ELECTRON_VERSION, TEST_DIR } from "./config" const util = require("../../../packages/electron-builder-util/out/util") const isEmptyOrSpaces = util.isEmptyOrSpaces -const downloadElectron: (options: any) => Promise = BluebirdPromise.promisify(require("electron-download-tf")) +const downloadElectron: (options: any) => Promise = BluebirdPromise.promisify(require("@electron-builder/electron-download")) runTests() .catch(error => { diff --git a/yarn.lock b/yarn.lock index a28efe42f44..4928f4d1a8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,6 +31,20 @@ typescript "~2.1.5" yargs "^7.0.2" +"@electron-builder/electron-download@4.2.1": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@electron-builder/electron-download/-/electron-download-4.2.1.tgz#b10b7b077523ae2f6c21dc05658df145d716c223" + dependencies: + debug "^2.6.3" + env-paths "^1.0.0" + fs-extra "^2.1.2" + minimist "^1.2.0" + nugget "^2.0.1" + path-exists "^3.0.0" + rc "^1.2.1" + semver "^5.3.0" + sumchecker "^2.0.2" + "@types/electron@^1.4.35": version "1.4.35" resolved "https://registry.yarnpkg.com/@types/electron/-/electron-1.4.35.tgz#48e5e6ef0b49f27b9f78b87d80f796e3f0a4f33c" @@ -1064,19 +1078,6 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -electron-download-tf@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/electron-download-tf/-/electron-download-tf-4.1.1.tgz#127aaa6a10ccf598bc15ed6ae83390348ebb3b4b" - dependencies: - debug "^2.6.3" - fs-extra "^2.1.2" - minimist "^1.2.0" - nugget "^2.0.1" - path-exists "^3.0.0" - rc "^1.1.7" - semver "^5.3.0" - sumchecker "^2.0.2" - electron-osx-sign@0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/electron-osx-sign/-/electron-osx-sign-0.4.4.tgz#afdf38450ccaebe6dabeca71fb0fad6294a8c57c" @@ -1095,6 +1096,10 @@ end-of-stream@^1.0.0: dependencies: once "^1.4.0" +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + "errno@>=0.1.1 <0.2.0-0": version "0.1.4" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" @@ -2612,7 +2617,7 @@ randomatic@^1.1.3: is-number "^2.0.2" kind-of "^3.0.2" -rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: +rc@^1.0.1, rc@^1.1.6, rc@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" dependencies: