diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml index e5ef57894ec..2dc4be9e693 100644 --- a/.idea/dictionaries/develar.xml +++ b/.idea/dictionaries/develar.xml @@ -99,6 +99,7 @@ goglobal graphicsmagick grün + grünwald gsettings gtar guid diff --git a/.idea/electron-builder.iml b/.idea/electron-builder.iml index 763d4fb57b0..f5481fd5971 100644 --- a/.idea/electron-builder.iml +++ b/.idea/electron-builder.iml @@ -10,13 +10,14 @@ + + - diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md index 70d73e1aa24..5d633bbae04 100644 --- a/docs/api/electron-builder.md +++ b/docs/api/electron-builder.md @@ -163,7 +163,7 @@ | isTwoPackageJsonProjectLayoutUsed = true| Boolean | | eventEmitter = new EventEmitter()| internal:EventEmitter | | **appInfo**| [AppInfo](#AppInfo) | -| tempDirManager = new TmpDir()| module:electron-builder-util/out/tmp.TmpDir | +| tempDirManager = new TmpDir()| module:builder-util/out/tmp.TmpDir | | options| [PackagerOptions](Options#PackagerOptions) | | **repositoryInfo**| Promise< \| [SourceRepositoryInfo](#SourceRepositoryInfo)> | | **productionDeps**| [Lazy](electron-builder-http#Lazy)<Array<module:electron-builder/out/util/packageDependencies.Dependency>> | diff --git a/package.json b/package.json index fe333fb1d41..87c5df0e8f9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "private": true, "license": "MIT", "scripts": { - "compile": "ts-babel packages/asar-integrity packages/electron-builder-http packages/electron-builder-util packages/electron-publish packages/electron-builder packages/electron-builder-squirrel-windows packages/electron-updater packages/electron-publisher-s3 test && yarn schema", + "//": "do not wrap into single quotes - windows doesn't unwrap arg in this case", + "compile": "ts-babel \"packages/*\" test && yarn schema", "lint": "node test/out/helpers/lint.js", "lint-deps": "node ./test/out/helpers/checkDeps.js", "pretest": "yarn compile && node test/out/helpers/lint.js && node ./test/out/helpers/checkDeps.js", @@ -10,7 +11,7 @@ "test": "node ./test/out/helpers/runTests.js skipArtifactPublisher ALL_TESTS=isCi", "test-all": "yarn pretest && node ./test/out/helpers/runTests.js", "test-linux": "docker run --rm -ti -v ${PWD}:/project -v ${PWD##*/}-node-modules:/project/node_modules -v ~/.electron:/root/.electron electronuserland/electron-builder:wine /bin/bash -c \"yarn && yarn test\"", - "//": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)", + "////": "Update wiki if docs changed. Update only if functionalily are generally available (latest release, not next)", "update-wiki": "(git branch -D wiki || true) && git subtree split -b wiki --prefix docs/ && git push -f wiki wiki:master", "whitespace": "whitespace 'src/**/*.ts'", "docker-images": "docker/build.sh", @@ -18,7 +19,7 @@ "set-versions": "node test/out/helpers/setVersions.js", "release": "yarn set-versions && yarn compile && ./scripts/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s", "schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --titles --required", - "jsdoc": "ts2jsdoc packages/electron-builder-http packages/electron-updater packages/electron-builder-util packages/electron-builder packages/electron-publish", + "jsdoc": "ts2jsdoc packages/electron-builder-http packages/electron-updater packages/builder-util packages/electron-builder packages/electron-publish", "jsdoc2md": "node scripts/jsdoc2md.js", "api": "yarn jsdoc && yarn jsdoc2md" }, @@ -27,6 +28,7 @@ "///": "all dependencies for all packages (hoisted)", "dependencies": { "7zip-bin": "^2.2.3", + "@types/debug": "^0.0.30", "ajv": "^5.2.2", "ajv-keywords": "^2.1.0", "archiver": "^2.0.0", @@ -40,7 +42,7 @@ "dotenv": "^4.0.0", "dotenv-expand": "^4.0.1", "ejs": "^2.5.7", - "electron-download-tf": "4.3.1", + "electron-download-tf": "4.3.4", "electron-is-dev": "^0.3.0", "electron-osx-sign": "0.4.7", "fcopy-pre-bundled": "0.3.4", @@ -74,8 +76,9 @@ "devDependencies": { "@types/dotenv": "^4.0.1", "@types/ini": "^1.3.29", - "@types/jest": "^20.0.7", + "@types/jest": "^20.0.8", "@types/js-yaml": "^3.9.1", + "@types/sanitize-filename": "^1.1.28", "@types/source-map-support": "^0.4.0", "@types/xml2js": "^0.4.0", "babel-preset-ts-node4-bluebird": "^0.1.0", @@ -90,7 +93,7 @@ "jest-junit": "^2.1.0", "jsdoc-to-markdown": "^3.0.0", "path-sort": "^0.1.0", - "ts-babel": "^4.0.1", + "ts-babel": "^4.1.3", "ts-jsdoc": "^2.0.5", "tslint": "^5.6.0", "typescript": "^2.5.0", diff --git a/packages/electron-builder-util/package.json b/packages/builder-util/package.json similarity index 96% rename from packages/electron-builder-util/package.json rename to packages/builder-util/package.json index 27daceb649b..0ae5fccd41c 100644 --- a/packages/electron-builder-util/package.json +++ b/packages/builder-util/package.json @@ -1,5 +1,5 @@ { - "name": "electron-builder-util", + "name": "builder-util", "version": "0.0.0-semantic-release", "main": "out/util.js", "author": "Vladimir Krivosheev", diff --git a/packages/electron-builder-util/readme.md b/packages/builder-util/readme.md similarity index 77% rename from packages/electron-builder-util/readme.md rename to packages/builder-util/readme.md index dc8f39d2d37..60c99411f11 100644 --- a/packages/electron-builder-util/readme.md +++ b/packages/builder-util/readme.md @@ -1,3 +1,3 @@ -# electron-builder-util +# builder-util Part of [electron-builder](https://github.com/electron-userland/electron-builder). \ No newline at end of file diff --git a/packages/builder-util/src/api.ts b/packages/builder-util/src/api.ts new file mode 100644 index 00000000000..ad6aea4e5bc --- /dev/null +++ b/packages/builder-util/src/api.ts @@ -0,0 +1,7 @@ +export interface PackageBuilder { + readonly buildResourcesDir: string + + readonly resourceList: Promise> + + getTempFile(suffix: string): Promise +} \ No newline at end of file diff --git a/packages/electron-builder-util/src/arch.ts b/packages/builder-util/src/arch.ts similarity index 100% rename from packages/electron-builder-util/src/arch.ts rename to packages/builder-util/src/arch.ts diff --git a/packages/electron-builder/src/util/asyncTaskManager.ts b/packages/builder-util/src/asyncTaskManager.ts similarity index 95% rename from packages/electron-builder/src/util/asyncTaskManager.ts rename to packages/builder-util/src/asyncTaskManager.ts index d21dd721496..54552d7b503 100644 --- a/packages/electron-builder/src/util/asyncTaskManager.ts +++ b/packages/builder-util/src/asyncTaskManager.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" import { CancellationToken } from "electron-builder-http" -import { debug } from "electron-builder-util" -import { NestedError } from "electron-builder-util/out/promise" +import { NestedError } from "./promise" +import { debug } from "./util" export class AsyncTaskManager { readonly tasks: Array> = [] diff --git a/packages/electron-builder-util/src/binDownload.ts b/packages/builder-util/src/binDownload.ts similarity index 100% rename from packages/electron-builder-util/src/binDownload.ts rename to packages/builder-util/src/binDownload.ts diff --git a/packages/electron-builder-util/src/bundledTool.ts b/packages/builder-util/src/bundledTool.ts similarity index 100% rename from packages/electron-builder-util/src/bundledTool.ts rename to packages/builder-util/src/bundledTool.ts diff --git a/packages/electron-builder-util/src/fs.ts b/packages/builder-util/src/fs.ts similarity index 100% rename from packages/electron-builder-util/src/fs.ts rename to packages/builder-util/src/fs.ts diff --git a/packages/electron-builder/src/util/langs.ts b/packages/builder-util/src/langs.ts similarity index 99% rename from packages/electron-builder/src/util/langs.ts rename to packages/builder-util/src/langs.ts index 98e664d8ae5..5de4947f891 100644 --- a/packages/electron-builder/src/util/langs.ts +++ b/packages/builder-util/src/langs.ts @@ -16,7 +16,6 @@ export function toLangWithRegion(lang: string): string { return result == null ? `${lang}_${lang.toUpperCase()}` : result } -/** @internal */ export const lcid: any = { af_ZA: 1078, am_ET: 1118, diff --git a/packages/electron-builder/src/targets/license.ts b/packages/builder-util/src/license.ts similarity index 79% rename from packages/electron-builder/src/targets/license.ts rename to packages/builder-util/src/license.ts index 56ccce95ef1..eb378bbb2cf 100644 --- a/packages/electron-builder/src/targets/license.ts +++ b/packages/builder-util/src/license.ts @@ -1,9 +1,8 @@ import * as path from "path" -import { PlatformPackager } from "../platformPackager" -import { langIdToName, toLangWithRegion } from "../util/langs" +import { PackageBuilder } from "./api" +import { langIdToName, toLangWithRegion } from "./langs" -/** @internal */ -export async function getLicenseFiles(packager: PlatformPackager): Promise> { +export async function getLicenseFiles(packager: PackageBuilder): Promise> { const files = (await packager.resourceList) .filter(it => { const name = it.toLowerCase() @@ -30,7 +29,6 @@ export async function getLicenseFiles(packager: PlatformPackager): Promise< }) } -/** @internal */ export interface LicenseFile { file: string lang: string diff --git a/packages/electron-builder-util/src/log.ts b/packages/builder-util/src/log.ts similarity index 100% rename from packages/electron-builder-util/src/log.ts rename to packages/builder-util/src/log.ts diff --git a/packages/electron-builder-util/src/macosVersion.ts b/packages/builder-util/src/macosVersion.ts similarity index 100% rename from packages/electron-builder-util/src/macosVersion.ts rename to packages/builder-util/src/macosVersion.ts diff --git a/packages/electron-builder-util/src/nodeHttpExecutor.ts b/packages/builder-util/src/nodeHttpExecutor.ts similarity index 100% rename from packages/electron-builder-util/src/nodeHttpExecutor.ts rename to packages/builder-util/src/nodeHttpExecutor.ts diff --git a/packages/electron-builder-util/src/promise.ts b/packages/builder-util/src/promise.ts similarity index 100% rename from packages/electron-builder-util/src/promise.ts rename to packages/builder-util/src/promise.ts diff --git a/packages/electron-builder-util/src/util.ts b/packages/builder-util/src/util.ts similarity index 94% rename from packages/electron-builder-util/src/util.ts rename to packages/builder-util/src/util.ts index 4580fbcf905..bd5875419f8 100644 --- a/packages/electron-builder-util/src/util.ts +++ b/packages/builder-util/src/util.ts @@ -12,6 +12,7 @@ export { log, warn, task, subTask } from "./log" export { isMacOsSierra } from "./macosVersion" export { execWine, prepareWindowsExecutableArgs } from "./wine" export { Arch, toLinuxArchString, getArchSuffix, ArchType, archFromString } from "./arch" +export { AsyncTaskManager } from "./asyncTaskManager" export const debug = _debug("electron-builder") export const debug7z = _debug("electron-builder:7z") @@ -72,6 +73,13 @@ export function exec(file: string, args?: Array | null, options?: ExecOp message += `\n${yellow(stdout.toString())}` } if (stderr.length !== 0) { + if (file.endsWith("wine")) { + stderr = stderr.toString() + .split("\n") + .filter(it => !it.includes("wine: cannot find L\"C:\\\\windows\\\\system32\\\\winemenubuilder.exe\"") && !it.includes("err:wineboot:ProcessRunKeys Error running cmd L\"C:\\\\windows\\\\system32\\\\winemenubuilder.exe")) + .join("\n") + } + message += `\n${red(stderr.toString())}` } @@ -163,7 +171,7 @@ export function handleProcess(event: string, childProcess: ChildProcess, command childProcess.once(event, (code: number) => { if (code === 0 && debug.enabled) { - debug(`${command} (${childProcess.pid}) exited with exit code 0`) + debug(`${path.basename(command)} (${childProcess.pid}) exited with exit code 0`) } if (code === 0) { @@ -188,10 +196,7 @@ export function use(value: T | null, task: (it: T) => R): R | null { export function debug7zArgs(command: "a" | "x"): Array { const args = [command, "-bd"] if (debug7z.enabled) { - args.push("-bb3") - } - else if (!debug.enabled) { - args.push("-bb0") + args.push("-bb") } return args } diff --git a/packages/electron-builder-util/src/wine.ts b/packages/builder-util/src/wine.ts similarity index 93% rename from packages/electron-builder-util/src/wine.ts rename to packages/builder-util/src/wine.ts index fe4ad6cc45d..a0f9eea3b51 100644 --- a/packages/electron-builder-util/src/wine.ts +++ b/packages/builder-util/src/wine.ts @@ -7,8 +7,11 @@ import { isMacOsSierra } from "./macosVersion" import { debug, exec, ExecOptions, isEnvTrue } from "./util" const wineExecutable = new Lazy(async () => { - debug(`USE_SYSTEM_WINE: ${process.env.USE_SYSTEM_WINE}`) - if (!isEnvTrue(process.env.USE_SYSTEM_WINE) && await isMacOsSierra()) { + const isUseSystemWine = isEnvTrue(process.env.USE_SYSTEM_WINE) + if (isUseSystemWine) { + debug("Using system wine is forced") + } + if (!isUseSystemWine && await isMacOsSierra()) { // noinspection SpellCheckingInspection const wineDir = await getBinFromGithub("wine", "2.0.1-mac-10.12", "IvKwDml/Ob0vKfYVxcu92wxUzHu8lTQSjjb8OlCTQ6bdNpVkqw17OM14TPpzGMIgSxfVIrQZhZdCwpkxLyG3mg==") return { diff --git a/packages/electron-builder-util/tsconfig.json b/packages/builder-util/tsconfig.json similarity index 93% rename from packages/electron-builder-util/tsconfig.json rename to packages/builder-util/tsconfig.json index 5e5a8243c99..ff4e723ee9a 100644 --- a/packages/electron-builder-util/tsconfig.json +++ b/packages/builder-util/tsconfig.json @@ -11,7 +11,6 @@ "../../typings/semver.d.ts", "../../typings/stat-mode.d.ts", "../../typings/chalk.d.ts", - "../../typings/debug.d.ts", "../../typings/node-emoji.d.ts", "../../typings/fcopy-pre-bundled.d.ts" ], diff --git a/packages/dmg-builder/package.json b/packages/dmg-builder/package.json new file mode 100644 index 00000000000..baf74d6d30a --- /dev/null +++ b/packages/dmg-builder/package.json @@ -0,0 +1,21 @@ +{ + "name": "dmg-builder", + "version": "0.0.0-semantic-release", + "main": "out/httpExecutor.js", + "author": "Vladimir Krivosheev", + "license": "MIT", + "repository": "electron-userland/electron-builder", + "bugs": "https://github.com/electron-userland/electron-builder/issues", + "homepage": "https://github.com/electron-userland/electron-builder", + "files": [ + "out" + ], + "dependencies": { + "fs-extra-p": "^4.4.0", + "bluebird-lst": "^1.0.3", + "iconv-lite": "^0.4.18", + "parse-color": "^1.0.0", + "builder-util": "^0.0.0-semantic-release" + }, + "typings": "./out/dmg.d.ts" +} diff --git a/packages/dmg-builder/readme.md b/packages/dmg-builder/readme.md new file mode 100644 index 00000000000..e6d7eead873 --- /dev/null +++ b/packages/dmg-builder/readme.md @@ -0,0 +1,3 @@ +# electron-builder-http + +Part of [electron-builder](https://github.com/electron-userland/electron-builder). \ No newline at end of file diff --git a/packages/electron-builder/src/targets/dmg/dmgLicense.ts b/packages/dmg-builder/src/dmgLicense.ts similarity index 93% rename from packages/electron-builder/src/targets/dmg/dmgLicense.ts rename to packages/dmg-builder/src/dmgLicense.ts index ac1de2b6ea9..0d69653799a 100644 --- a/packages/electron-builder/src/targets/dmg/dmgLicense.ts +++ b/packages/dmg-builder/src/dmgLicense.ts @@ -1,11 +1,10 @@ -import { debug, exec } from "electron-builder-util" +import { debug, exec } from "builder-util" +import { PackageBuilder } from "builder-util/out/api" +import { getLicenseFiles } from "builder-util/out/license" import { outputFile, readFile } from "fs-extra-p" -import { PlatformPackager } from "../../platformPackager" -import { getLicenseFiles } from "../license" -import { getVendorPath } from "../../util/pathManager" +import { getDmgVendorPath } from "./dmgUtil" -/** @internal */ -export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: string) { +export async function addLicenseToDmg(packager: PackageBuilder, dmgPath: string) { const licenseFiles = await getLicenseFiles(packager) if (licenseFiles.length === 0) { return @@ -60,7 +59,7 @@ export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: await exec("/usr/bin/python", [tempFile], { env: { ...process.env, - PYTHONPATH: getVendorPath(), + PYTHONPATH: getDmgVendorPath(), LC_CTYPE: "en_US.UTF-8", LANG: "en_US.UTF-8", } diff --git a/packages/dmg-builder/src/dmgUtil.ts b/packages/dmg-builder/src/dmgUtil.ts new file mode 100644 index 00000000000..a2e24829c5c --- /dev/null +++ b/packages/dmg-builder/src/dmgUtil.ts @@ -0,0 +1,80 @@ +import BluebirdPromise from "bluebird-lst" +import { exec } from "builder-util" +import { PackageBuilder } from "builder-util/out/api" +import { AsyncTaskManager } from "builder-util/out/asyncTaskManager" +import { executeFinally } from "builder-util/out/promise" +import { outputFile, readFile } from "fs-extra-p" +import * as path from "path" + +const root = path.join(__dirname, "..") + +export function getDmgTemplatePath() { + return path.join(root, "templates") +} + +export function getDmgVendorPath() { + return path.join(root, "vendor") +} + +export async function attachAndExecute(dmgPath: string, readWrite: boolean, task: () => Promise) { + //noinspection SpellCheckingInspection + const args = ["attach", "-noverify", "-noautoopen"] + if (readWrite) { + args.push("-readwrite") + } + + args.push(dmgPath) + const attachResult = await exec("hdiutil", args, {maxBuffer: 2 * 1024 * 1024}) + const deviceResult = attachResult == null ? null : /^(\/dev\/\w+)/.exec(attachResult) + const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1] + if (device == null) { + throw new Error(`Cannot mount: ${attachResult}`) + } + + return await executeFinally(task(), () => detach(device)) +} + +export async function detach(name: string) { + try { + await exec("hdiutil", ["detach", name]) + } + catch (e) { + await new BluebirdPromise((resolve, reject) => { + setTimeout(() => { + exec("hdiutil", ["detach", "-force", name]) + .then(resolve) + .catch(reject) + }, 1000) + }) + } +} + +export function computeBackgroundColor(rawValue: string) { + return require("parse-color")(rawValue).hex +} + +export async function computeBackground(packager: PackageBuilder) { + const resourceList = await packager.resourceList + if (resourceList.includes("background.tiff")) { + return path.join(packager.buildResourcesDir, "background.tiff") + } + else if (resourceList.includes("background.png")) { + return path.join(packager.buildResourcesDir, "background.png") + } + else { + return path.join(getDmgTemplatePath(), "background.tiff") + } +} + +export async function applyProperties(entries: any, env: any, asyncTaskManager: AsyncTaskManager, packager: PackageBuilder) { + const dmgPropertiesFile = await packager.getTempFile("dmgProperties.pl") + + asyncTaskManager.addTask(outputFile(dmgPropertiesFile, (await readFile(path.join(getDmgTemplatePath(), "dmgProperties.pl"), "utf-8")).replace("$ENTRIES", entries))) + + await asyncTaskManager.awaitTasks() + + await exec("/usr/bin/perl", [dmgPropertiesFile], { + cwd: getDmgVendorPath(), + env + }) +} \ No newline at end of file diff --git a/packages/electron-builder/templates/dmg/background.tiff b/packages/dmg-builder/templates/background.tiff similarity index 100% rename from packages/electron-builder/templates/dmg/background.tiff rename to packages/dmg-builder/templates/background.tiff diff --git a/packages/electron-builder/templates/dmg/dmgProperties.pl b/packages/dmg-builder/templates/dmgProperties.pl similarity index 100% rename from packages/electron-builder/templates/dmg/dmgProperties.pl rename to packages/dmg-builder/templates/dmgProperties.pl diff --git a/packages/electron-builder/templates/dmg/license.txt b/packages/dmg-builder/templates/license.txt similarity index 100% rename from packages/electron-builder/templates/dmg/license.txt rename to packages/dmg-builder/templates/license.txt diff --git a/packages/electron-builder/templates/dmg/settings.py b/packages/dmg-builder/templates/settings.py similarity index 100% rename from packages/electron-builder/templates/dmg/settings.py rename to packages/dmg-builder/templates/settings.py diff --git a/packages/dmg-builder/tsconfig.json b/packages/dmg-builder/tsconfig.json new file mode 100644 index 00000000000..5059ac39e9f --- /dev/null +++ b/packages/dmg-builder/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "out" + }, + "include": [ + "src/**/*.ts" + ] +} \ No newline at end of file diff --git a/packages/electron-builder/vendor/Mac/Finder/DSStore.pm b/packages/dmg-builder/vendor/Mac/Finder/DSStore.pm similarity index 100% rename from packages/electron-builder/vendor/Mac/Finder/DSStore.pm rename to packages/dmg-builder/vendor/Mac/Finder/DSStore.pm diff --git a/packages/electron-builder/vendor/Mac/Finder/DSStore/BuddyAllocator.pm b/packages/dmg-builder/vendor/Mac/Finder/DSStore/BuddyAllocator.pm similarity index 100% rename from packages/electron-builder/vendor/Mac/Finder/DSStore/BuddyAllocator.pm rename to packages/dmg-builder/vendor/Mac/Finder/DSStore/BuddyAllocator.pm diff --git a/packages/electron-builder/vendor/Mac/Finder/DSStore/Format.pod b/packages/dmg-builder/vendor/Mac/Finder/DSStore/Format.pod similarity index 100% rename from packages/electron-builder/vendor/Mac/Finder/DSStore/Format.pod rename to packages/dmg-builder/vendor/Mac/Finder/DSStore/Format.pod diff --git a/packages/electron-builder/vendor/biplist/__init__.py b/packages/dmg-builder/vendor/biplist/__init__.py similarity index 100% rename from packages/electron-builder/vendor/biplist/__init__.py rename to packages/dmg-builder/vendor/biplist/__init__.py diff --git a/packages/electron-builder/vendor/dmgbuild/__init__.py b/packages/dmg-builder/vendor/dmgbuild/__init__.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/__init__.py rename to packages/dmg-builder/vendor/dmgbuild/__init__.py diff --git a/packages/electron-builder/vendor/dmgbuild/badge.py b/packages/dmg-builder/vendor/dmgbuild/badge.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/badge.py rename to packages/dmg-builder/vendor/dmgbuild/badge.py diff --git a/packages/electron-builder/vendor/dmgbuild/colors.py b/packages/dmg-builder/vendor/dmgbuild/colors.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/colors.py rename to packages/dmg-builder/vendor/dmgbuild/colors.py diff --git a/packages/electron-builder/vendor/dmgbuild/core.py b/packages/dmg-builder/vendor/dmgbuild/core.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/core.py rename to packages/dmg-builder/vendor/dmgbuild/core.py diff --git a/packages/electron-builder/vendor/dmgbuild/licensing.py b/packages/dmg-builder/vendor/dmgbuild/licensing.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/licensing.py rename to packages/dmg-builder/vendor/dmgbuild/licensing.py diff --git a/packages/electron-builder/vendor/dmgbuild/resources.py b/packages/dmg-builder/vendor/dmgbuild/resources.py similarity index 100% rename from packages/electron-builder/vendor/dmgbuild/resources.py rename to packages/dmg-builder/vendor/dmgbuild/resources.py diff --git a/packages/electron-builder/vendor/ds_store/__init__.py b/packages/dmg-builder/vendor/ds_store/__init__.py similarity index 100% rename from packages/electron-builder/vendor/ds_store/__init__.py rename to packages/dmg-builder/vendor/ds_store/__init__.py diff --git a/packages/electron-builder/vendor/ds_store/buddy.py b/packages/dmg-builder/vendor/ds_store/buddy.py similarity index 100% rename from packages/electron-builder/vendor/ds_store/buddy.py rename to packages/dmg-builder/vendor/ds_store/buddy.py diff --git a/packages/electron-builder/vendor/ds_store/store.py b/packages/dmg-builder/vendor/ds_store/store.py similarity index 100% rename from packages/electron-builder/vendor/ds_store/store.py rename to packages/dmg-builder/vendor/ds_store/store.py diff --git a/packages/electron-builder/vendor/mac_alias/__init__.py b/packages/dmg-builder/vendor/mac_alias/__init__.py similarity index 100% rename from packages/electron-builder/vendor/mac_alias/__init__.py rename to packages/dmg-builder/vendor/mac_alias/__init__.py diff --git a/packages/electron-builder/vendor/mac_alias/alias.py b/packages/dmg-builder/vendor/mac_alias/alias.py similarity index 100% rename from packages/electron-builder/vendor/mac_alias/alias.py rename to packages/dmg-builder/vendor/mac_alias/alias.py diff --git a/packages/electron-builder/vendor/mac_alias/bookmark.py b/packages/dmg-builder/vendor/mac_alias/bookmark.py similarity index 100% rename from packages/electron-builder/vendor/mac_alias/bookmark.py rename to packages/dmg-builder/vendor/mac_alias/bookmark.py diff --git a/packages/electron-builder/vendor/mac_alias/osx.py b/packages/dmg-builder/vendor/mac_alias/osx.py similarity index 100% rename from packages/electron-builder/vendor/mac_alias/osx.py rename to packages/dmg-builder/vendor/mac_alias/osx.py diff --git a/packages/electron-builder/vendor/mac_alias/utils.py b/packages/dmg-builder/vendor/mac_alias/utils.py similarity index 100% rename from packages/electron-builder/vendor/mac_alias/utils.py rename to packages/dmg-builder/vendor/mac_alias/utils.py diff --git a/packages/electron-builder-http/tsconfig.json b/packages/electron-builder-http/tsconfig.json index 90fc017971d..2368178023b 100644 --- a/packages/electron-builder-http/tsconfig.json +++ b/packages/electron-builder-http/tsconfig.json @@ -10,8 +10,5 @@ }, "include": [ "src/**/*.ts" - ], - "files": [ - "../../typings/debug.d.ts" ] } \ No newline at end of file diff --git a/packages/electron-builder-squirrel-windows/package.json b/packages/electron-builder-squirrel-windows/package.json index 4dbdcd2d003..501f9ad3af7 100644 --- a/packages/electron-builder-squirrel-windows/package.json +++ b/packages/electron-builder-squirrel-windows/package.json @@ -11,7 +11,7 @@ "out" ], "dependencies": { - "electron-builder-util": "~0.0.0-semantic-release", + "builder-util": "^0.0.0-semantic-release", "bluebird-lst": "^1.0.3", "fs-extra-p": "^4.4.0", "archiver": "^2.0.0", diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts index b1f22e21be8..ccc2ab5bdbe 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, debug, exec, execWine, log, prepareWindowsExecutableArgs as prepareArgs, spawn } from "electron-builder-util" -import { copyFile, walk } from "electron-builder-util/out/fs" +import { Arch, debug, exec, execWine, log, prepareWindowsExecutableArgs as prepareArgs, spawn } from "builder-util" +import { copyFile, walk } from "builder-util/out/fs" import { WinPackager } from "electron-builder/out/winPackager" import { createWriteStream, ensureDir, remove, stat, unlink } from "fs-extra-p" import * as path from "path" diff --git a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts index 9931f4a2884..9efb788f8dd 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelWindows.ts @@ -1,6 +1,6 @@ import { Arch, getArchSuffix, Target } from "electron-builder" -import { log, warn } from "electron-builder-util" -import { getBinFromGithub } from "electron-builder-util/out/binDownload" +import { log, warn } from "builder-util" +import { getBinFromGithub } from "builder-util/out/binDownload" import { SquirrelWindowsOptions } from "electron-builder/out/options/winOptions" import { WinPackager } from "electron-builder/out/winPackager" import * as path from "path" diff --git a/packages/electron-builder-squirrel-windows/tsconfig.json b/packages/electron-builder-squirrel-windows/tsconfig.json index 3a8f0b71149..5059ac39e9f 100644 --- a/packages/electron-builder-squirrel-windows/tsconfig.json +++ b/packages/electron-builder-squirrel-windows/tsconfig.json @@ -5,9 +5,5 @@ }, "include": [ "src/**/*.ts" - ], - "files": [ - "../../typings/debug.d.ts", - "../../typings/sanitize-filename.d.ts" ] } \ No newline at end of file diff --git a/packages/electron-builder/package.json b/packages/electron-builder/package.json index f97235417c5..e4f266bb425 100644 --- a/packages/electron-builder/package.json +++ b/packages/electron-builder/package.json @@ -59,8 +59,8 @@ "chromium-pickle-js": "^0.2.0", "cuint": "^0.2.2", "electron-builder-http": "0.0.0-semantic-release", - "electron-builder-util": "0.0.0-semantic-release", - "electron-download-tf": "4.3.1", + "builder-util": "0.0.0-semantic-release", + "electron-download-tf": "4.3.4", "electron-osx-sign": "0.4.7", "electron-publish": "0.0.0-semantic-release", "fs-extra-p": "^4.4.0", @@ -71,7 +71,6 @@ "read-config-file": "^1.0.5", "minimatch": "^3.0.4", "normalize-package-data": "^2.4.0", - "parse-color": "^1.0.0", "plist": "^2.1.0", "sanitize-filename": "^1.6.1", "semver": "^5.4.1", @@ -85,7 +84,7 @@ "dotenv-expand": "^4.0.1", "temp-file": "^2.0.2", "ejs": "^2.5.7", - "iconv-lite": "^0.4.18" + "dmg-builder": "0.0.0-semantic-release" }, "typings": "./out/index.d.ts", "publishConfig": { diff --git a/packages/electron-builder/src/DebugLogger.ts b/packages/electron-builder/src/DebugLogger.ts new file mode 100644 index 00000000000..18ad48d84ed --- /dev/null +++ b/packages/electron-builder/src/DebugLogger.ts @@ -0,0 +1,47 @@ +import BluebirdPromise from "bluebird-lst" +import { outputFile } from "fs-extra-p" +import { safeDump } from "js-yaml" + +export class DebugLogger { + readonly data: any = {} + + constructor(readonly enabled = true) { + } + + add(key: string, value: any) { + const dataPath = key.split(".") + let o = this.data + let lastName: string | null = null + for (const p of dataPath) { + if (p === dataPath[dataPath.length - 1]) { + lastName = p + break + } + else { + if (o[p] == null) { + o[p] = Object.create(null) + } + else if (typeof o[p] === "string") { + o[p] = [o[p]] + } + o = o[p] + } + } + + if (Array.isArray(o[lastName!!])) { + o[lastName!!].push(value) + } + else { + o[lastName!!] = value + } + } + + save(file: string) { + if (Object.keys(this.data).length > 0) { + return outputFile(file, safeDump(this.data)) + } + else { + return BluebirdPromise.resolve() + } + } +} \ No newline at end of file diff --git a/packages/electron-builder/src/appInfo.ts b/packages/electron-builder/src/appInfo.ts index ed035f4cd0e..4039026644a 100644 --- a/packages/electron-builder/src/appInfo.ts +++ b/packages/electron-builder/src/appInfo.ts @@ -1,4 +1,4 @@ -import { isEmptyOrSpaces, smarten, warn } from "electron-builder-util" +import { isEmptyOrSpaces, smarten, warn } from "builder-util" import sanitizeFileName from "sanitize-filename" import { prerelease, SemVer } from "semver" import { Packager } from "./packager" diff --git a/packages/electron-builder/src/builder.ts b/packages/electron-builder/src/builder.ts index baf7e964e2c..014c56658c7 100644 --- a/packages/electron-builder/src/builder.ts +++ b/packages/electron-builder/src/builder.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" import { underline } from "chalk" import { CancellationToken } from "electron-builder-http" -import { addValue, Arch, archFromString, isEmptyOrSpaces, warn } from "electron-builder-util" -import { executeFinally } from "electron-builder-util/out/promise" +import { addValue, Arch, archFromString, isEmptyOrSpaces, warn } from "builder-util" +import { executeFinally } from "builder-util/out/promise" import { PublishOptions } from "electron-publish" import { DIR_TARGET, Platform } from "./core" import { normalizePlatforms, Packager } from "./packager" diff --git a/packages/electron-builder/src/cli/cli.ts b/packages/electron-builder/src/cli/cli.ts index 092d8f6ee30..a3d9467b9b2 100644 --- a/packages/electron-builder/src/cli/cli.ts +++ b/packages/electron-builder/src/cli/cli.ts @@ -2,8 +2,8 @@ import { cyan, dim, green, reset, underline } from "chalk" import { parse as parseEnv } from "dotenv" -import { exec, log, warn } from "electron-builder-util" -import { printErrorAndExit } from "electron-builder-util/out/promise" +import { exec, log, warn } from "builder-util" +import { printErrorAndExit } from "builder-util/out/promise" import { readFile, readJson } from "fs-extra-p" import isCi from "is-ci" import * as path from "path" diff --git a/packages/electron-builder/src/cli/create-self-signed-cert.ts b/packages/electron-builder/src/cli/create-self-signed-cert.ts index 569b9d51d5d..3c7afcf99f9 100644 --- a/packages/electron-builder/src/cli/create-self-signed-cert.ts +++ b/packages/electron-builder/src/cli/create-self-signed-cert.ts @@ -1,6 +1,6 @@ import { bold } from "chalk" -import { exec, log, spawn, TmpDir } from "electron-builder-util" -import { unlinkIfExists } from "electron-builder-util/out/fs" +import { exec, log, spawn, TmpDir } from "builder-util" +import { unlinkIfExists } from "builder-util/out/fs" import { ensureDir } from "fs-extra-p" import * as path from "path" import sanitizeFileName from "sanitize-filename" diff --git a/packages/electron-builder/src/cli/install-app-deps.ts b/packages/electron-builder/src/cli/install-app-deps.ts index fc1df2a0e6a..8d0f89bddfc 100644 --- a/packages/electron-builder/src/cli/install-app-deps.ts +++ b/packages/electron-builder/src/cli/install-app-deps.ts @@ -1,8 +1,8 @@ #! /usr/bin/env node import BluebirdPromise from "bluebird-lst" -import { log, use, warn } from "electron-builder-util" -import { printErrorAndExit } from "electron-builder-util/out/promise" +import { log, use, warn } from "builder-util" +import { printErrorAndExit } from "builder-util/out/promise" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" diff --git a/packages/electron-builder/src/codeSign.ts b/packages/electron-builder/src/codeSign.ts index fea6c92bfd7..cc6fa398ee8 100644 --- a/packages/electron-builder/src/codeSign.ts +++ b/packages/electron-builder/src/codeSign.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" import { randomBytes } from "crypto" -import { exec, getCacheDirectory, isEmptyOrSpaces, isMacOsSierra, TmpDir } from "electron-builder-util" -import { copyFile, statOrNull, unlinkIfExists } from "electron-builder-util/out/fs" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { exec, getCacheDirectory, isEmptyOrSpaces, isMacOsSierra, TmpDir } from "builder-util" +import { copyFile, statOrNull, unlinkIfExists } from "builder-util/out/fs" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { outputFile, rename } from "fs-extra-p" import { Lazy } from "lazy-val" import { homedir } from "os" diff --git a/packages/electron-builder/src/core.ts b/packages/electron-builder/src/core.ts index a3d27151a15..84702fb975e 100644 --- a/packages/electron-builder/src/core.ts +++ b/packages/electron-builder/src/core.ts @@ -1,5 +1,5 @@ import { Publish } from "electron-builder-http/out/publishOptions" -import { Arch, archFromString, ArchType } from "electron-builder-util" +import { Arch, archFromString, ArchType } from "builder-util" export type TargetConfigType = Array | string | TargetConfig | null diff --git a/packages/electron-builder/src/fileMatcher.ts b/packages/electron-builder/src/fileMatcher.ts index 9ee0fc64378..1de8f2f9665 100644 --- a/packages/electron-builder/src/fileMatcher.ts +++ b/packages/electron-builder/src/fileMatcher.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { asArray, debug, warn } from "electron-builder-util" -import { copyDir, copyOrLinkFile, Filter, statOrNull } from "electron-builder-util/out/fs" +import { asArray, debug, warn } from "builder-util" +import { copyDir, copyOrLinkFile, Filter, statOrNull } from "builder-util/out/fs" import { mkdirs } from "fs-extra-p" import { Minimatch } from "minimatch" import * as path from "path" @@ -168,8 +168,11 @@ export function getMainFileMatchers(appDir: string, destination: string, macroEx // exclude ony for app root, use .yarnclean to clean node_modules patterns.push("!.editorconfig") - debug(`File patterns of first/default matcher:\n\t${patterns.join("\n\t")}`) - + const debugLogger = packager.info.debugLogger + if (debugLogger.enabled) { + //tslint:disable-next-line:no-invalid-template-strings + debugLogger.add(`${macroExpander("${arch}")}.firstOrDefaultFilePatterns`, patterns) + } return matchers } diff --git a/packages/electron-builder/src/fileTransformer.ts b/packages/electron-builder/src/fileTransformer.ts index b8e50b1e65c..b301736d9a5 100644 --- a/packages/electron-builder/src/fileTransformer.ts +++ b/packages/electron-builder/src/fileTransformer.ts @@ -1,5 +1,5 @@ -import { debug, warn } from "electron-builder-util" -import { FileTransformer } from "electron-builder-util/out/fs" +import { debug, warn } from "builder-util" +import { FileTransformer } from "builder-util/out/fs" import { readJson } from "fs-extra-p" import * as path from "path" import { deepAssign } from "read-config-file/out/deepAssign" diff --git a/packages/electron-builder/src/index.ts b/packages/electron-builder/src/index.ts index aec416ff646..358aaae6218 100644 --- a/packages/electron-builder/src/index.ts +++ b/packages/electron-builder/src/index.ts @@ -1,7 +1,7 @@ export { Packager, BuildResult } from "./packager" export { PackagerOptions, ArtifactCreated } from "./packagerApi" export { Platform, Target, DIR_TARGET } from "./core" -export { getArchSuffix, Arch, archFromString } from "electron-builder-util" +export { getArchSuffix, Arch, archFromString } from "builder-util" export { build, CliOptions, createTargets } from "./builder" export { Metadata, Config, AfterPackContext, MetadataDirectories, Protocol, FileAssociation, PlatformSpecificBuildOptions, AuthorMetadata, RepositoryInfo, AsarOptions, FilePattern, ReleaseInfo, ElectronDownloadOptions } from "./metadata" export { MacOptions, DmgOptions, MasBuildOptions, MacOsTargetName, PkgOptions, DmgContent, DmgWindow } from "./options/macOptions" diff --git a/packages/electron-builder/src/macPackager.ts b/packages/electron-builder/src/macPackager.ts index 29c08195a15..1329500f739 100644 --- a/packages/electron-builder/src/macPackager.ts +++ b/packages/electron-builder/src/macPackager.ts @@ -1,5 +1,5 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, exec, isPullRequest, log, task, warn } from "electron-builder-util" +import { Arch, AsyncTaskManager, exec, isPullRequest, log, task, warn } from "builder-util" import { signAsync, SignOptions } from "electron-osx-sign" import { ensureDir } from "fs-extra-p" import * as path from "path" @@ -10,10 +10,9 @@ import { DIR_TARGET, Platform, Target } from "./core" import { MacOptions, MasBuildOptions } from "./options/macOptions" import { Packager } from "./packager" import { PlatformPackager } from "./platformPackager" -import { DmgTarget } from "./targets/dmg/dmg" +import { DmgTarget } from "./targets/dmg" import { PkgTarget, prepareProductBuildArgs } from "./targets/pkg" import { createCommonTarget, NoOpTarget } from "./targets/targetFactory" -import { AsyncTaskManager } from "./util/asyncTaskManager" import { isAutoDiscoveryCodeSignIdentity } from "./util/flags" const buildForPrWarning = "There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + diff --git a/packages/electron-builder/src/metadata.ts b/packages/electron-builder/src/metadata.ts index c574eb82f0d..3dc9092eb6d 100644 --- a/packages/electron-builder/src/metadata.ts +++ b/packages/electron-builder/src/metadata.ts @@ -1,6 +1,6 @@ import { AsarIntegrityOptions } from "asar-integrity" import { Publish } from "electron-builder-http/out/publishOptions" -import { Arch } from "electron-builder-util" +import { Arch } from "builder-util" import { BeforeBuildContext, CompressionLevel, Target, TargetConfig, TargetSpecificOptions } from "./core" import { AppImageOptions, DebOptions, LinuxBuildOptions, LinuxTargetSpecificOptions } from "./options/linuxOptions" import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions" diff --git a/packages/electron-builder/src/options/macOptions.ts b/packages/electron-builder/src/options/macOptions.ts index b5773fbb207..7e186206ced 100644 --- a/packages/electron-builder/src/options/macOptions.ts +++ b/packages/electron-builder/src/options/macOptions.ts @@ -141,12 +141,12 @@ export interface DmgOptions extends TargetSpecificOptions { * If background is not specified, use `window.size`. Default locations expected background size to be 540x380. * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191). */ - readonly background?: string | null + background?: string | null /** * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image. */ - readonly backgroundColor?: string | null + backgroundColor?: string | null /** * The path to DMG icon (volume icon), which will be shown when mounted, relative to the the [build resources](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources) or to the project directory. diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts index 58eed076f06..397d9168e80 100644 --- a/packages/electron-builder/src/packager.ts +++ b/packages/electron-builder/src/packager.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" +import { Arch, AsyncTaskManager, debug, exec, log, safeStringifyJson, TmpDir, use } from "builder-util" +import { executeFinally, orNullIfFileNotExist } from "builder-util/out/promise" import { CancellationToken } from "electron-builder-http" -import { Arch, debug, exec, log, safeStringifyJson, TmpDir, use } from "electron-builder-util" -import { executeFinally, orNullIfFileNotExist } from "electron-builder-util/out/promise" import { EventEmitter } from "events" import { ensureDir } from "fs-extra-p" import { safeDump } from "js-yaml" @@ -11,12 +11,12 @@ import { deepAssign } from "read-config-file/out/deepAssign" import { AppInfo } from "./appInfo" import { readAsarJson } from "./asar" import { Platform, SourceRepositoryInfo, Target } from "./core" +import { DebugLogger } from "./DebugLogger" import MacPackager from "./macPackager" import { AfterPackContext, Config, Metadata } from "./metadata" import { ArtifactCreated, PackagerOptions } from "./packagerApi" import { PlatformPackager } from "./platformPackager" import { computeArchToTargetNamesMap, createTargets, NoOpTarget } from "./targets/targetFactory" -import { AsyncTaskManager } from "./util/asyncTaskManager" import { computeDefaultAppDirectory, getConfig, validateConfig } from "./util/config" import { computeElectronVersion, getElectronVersionFromInstalled } from "./util/electronVersion" import { createLazyProductionDeps, Dependency } from "./util/packageDependencies" @@ -65,6 +65,8 @@ export class Packager { readonly options: PackagerOptions + readonly debugLogger = new DebugLogger(debug.enabled) + get repositoryInfo(): Promise { return this._repositoryInfo.value } @@ -181,7 +183,12 @@ export class Packager { const outDir = path.resolve(this.projectDir, use(this.config.directories, it => it!.output) || "dist") return { outDir, - platformToTargets: await executeFinally(this.doBuild(outDir), () => this.tempDirManager.cleanup()) + platformToTargets: await executeFinally(this.doBuild(outDir), async () => { + if (this.debugLogger.enabled) { + await this.debugLogger.save(path.join(outDir, "electron-builder-debug.yml")) + } + await this.tempDirManager.cleanup() + }) } } diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts index fd59e958902..b3397059a31 100644 --- a/packages/electron-builder/src/packager/dirPackager.ts +++ b/packages/electron-builder/src/packager/dirPackager.ts @@ -1,7 +1,7 @@ import { path7za } from "7zip-bin" import BluebirdPromise from "bluebird-lst" -import { debug7zArgs, log, spawn } from "electron-builder-util" -import { copyDir, DO_NOT_USE_HARD_LINKS, statOrNull } from "electron-builder-util/out/fs" +import { debug7zArgs, log, spawn } from "builder-util" +import { copyDir, DO_NOT_USE_HARD_LINKS, statOrNull } from "builder-util/out/fs" import { chmod, emptyDir } from "fs-extra-p" import * as path from "path" import { Config, ElectronDownloadOptions } from "../metadata" diff --git a/packages/electron-builder/src/packager/mac.ts b/packages/electron-builder/src/packager/mac.ts index 68df04ca723..ae0a32809d4 100644 --- a/packages/electron-builder/src/packager/mac.ts +++ b/packages/electron-builder/src/packager/mac.ts @@ -1,7 +1,7 @@ import { AsarIntegrity } from "asar-integrity" import BluebirdPromise from "bluebird-lst" -import { asArray, getPlatformIconFileName, use, warn } from "electron-builder-util" -import { copyFile, copyOrLinkFile, unlinkIfExists } from "electron-builder-util/out/fs" +import { asArray, getPlatformIconFileName, use, warn } from "builder-util" +import { copyFile, copyOrLinkFile, unlinkIfExists } from "builder-util/out/fs" import { readFile, rename, utimes, writeFile } from "fs-extra-p" import * as path from "path" import { build as buildPlist, parse as parsePlist } from "plist" diff --git a/packages/electron-builder/src/packagerApi.ts b/packages/electron-builder/src/packagerApi.ts index e7e3b15f6e7..e18826b6ed6 100644 --- a/packages/electron-builder/src/packagerApi.ts +++ b/packages/electron-builder/src/packagerApi.ts @@ -1,5 +1,5 @@ import { PublishConfiguration } from "electron-builder-http/out/publishOptions" -import { Arch } from "electron-builder-util" +import { Arch } from "builder-util" import { Platform, Target } from "./core" import { Config } from "./metadata" import { Packager } from "./packager" diff --git a/packages/electron-builder/src/platformPackager.ts b/packages/electron-builder/src/platformPackager.ts index 4b3fa6957f3..faa815713a1 100644 --- a/packages/electron-builder/src/platformPackager.ts +++ b/packages/electron-builder/src/platformPackager.ts @@ -1,8 +1,9 @@ import { computeData } from "asar-integrity" import BluebirdPromise from "bluebird-lst" -import { Arch, asArray, getArchSuffix, isEmptyOrSpaces, log, use, warn } from "electron-builder-util" -import { statOrNull, unlinkIfExists } from "electron-builder-util/out/fs" -import { orIfFileNotExist } from "electron-builder-util/out/promise" +import { Arch, asArray, AsyncTaskManager, getArchSuffix, isEmptyOrSpaces, log, use, warn } from "builder-util" +import { PackageBuilder } from "builder-util/out/api" +import { statOrNull, unlinkIfExists } from "builder-util/out/fs" +import { orIfFileNotExist } from "builder-util/out/promise" import { readdir, rename } from "fs-extra-p" import { Lazy } from "lazy-val" import { Minimatch } from "minimatch" @@ -20,9 +21,8 @@ import { PackagerOptions } from "./packagerApi" import { copyAppFiles } from "./util/appFileCopier" import { computeFileSets, ELECTRON_COMPILE_SHIM_FILENAME } from "./util/AppFileCopierHelper" import { AsarPackager, checkFileInArchive } from "./util/asarUtil" -import { AsyncTaskManager } from "./util/asyncTaskManager" -export abstract class PlatformPackager { +export abstract class PlatformPackager implements PackageBuilder { readonly packagerOptions: PackagerOptions readonly projectDir: string diff --git a/packages/electron-builder/src/presets/rectCra.ts b/packages/electron-builder/src/presets/rectCra.ts index 347bc25657b..c0e4162369a 100644 --- a/packages/electron-builder/src/presets/rectCra.ts +++ b/packages/electron-builder/src/presets/rectCra.ts @@ -1,5 +1,5 @@ -import { warn } from "electron-builder-util" -import { statOrNull } from "electron-builder-util/out/fs" +import { warn } from "builder-util" +import { statOrNull } from "builder-util/out/fs" import * as path from "path" import { Config } from "../metadata" diff --git a/packages/electron-builder/src/publish/PublishManager.ts b/packages/electron-builder/src/publish/PublishManager.ts index e648c19cbce..a75ff4a8a59 100644 --- a/packages/electron-builder/src/publish/PublishManager.ts +++ b/packages/electron-builder/src/publish/PublishManager.ts @@ -1,10 +1,10 @@ import { hashFile } from "asar-integrity" import BluebirdPromise from "bluebird-lst" +import { Arch, asArray, AsyncTaskManager, isEmptyOrSpaces, isPullRequest, log, safeStringifyJson, warn } from "builder-util" import _debug from "debug" import { CancellationToken } from "electron-builder-http" import { BintrayOptions, GenericServerOptions, GithubOptions, githubUrl, PublishConfiguration, PublishProvider, S3Options, s3Url } from "electron-builder-http/out/publishOptions" import { UpdateInfo } from "electron-builder-http/out/updateInfo" -import { Arch, asArray, isEmptyOrSpaces, isPullRequest, log, safeStringifyJson, warn } from "electron-builder-util" import { getCiTag, HttpPublisher, PublishContext, Publisher, PublishOptions } from "electron-publish" import { BintrayPublisher } from "electron-publish/out/BintrayPublisher" import { GitHubPublisher } from "electron-publish/out/gitHubPublisher" @@ -21,7 +21,6 @@ import { PlatformSpecificBuildOptions, ReleaseInfo } from "../metadata" import { Packager } from "../packager" import { ArtifactCreated } from "../packagerApi" import { PlatformPackager } from "../platformPackager" -import { AsyncTaskManager } from "../util/asyncTaskManager" import { WinPackager } from "../winPackager" const publishForPrWarning = "There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + diff --git a/packages/electron-builder/src/targets/ArchiveTarget.ts b/packages/electron-builder/src/targets/ArchiveTarget.ts index e956b3fdd78..43fc9bc7557 100644 --- a/packages/electron-builder/src/targets/ArchiveTarget.ts +++ b/packages/electron-builder/src/targets/ArchiveTarget.ts @@ -1,4 +1,4 @@ -import { Arch, log } from "electron-builder-util" +import { Arch, log } from "builder-util" import * as path from "path" import { Platform, Target } from "../core" import { PlatformPackager } from "../platformPackager" diff --git a/packages/electron-builder/src/targets/LinuxTargetHelper.ts b/packages/electron-builder/src/targets/LinuxTargetHelper.ts index 8306b8e42a0..f33d4359296 100644 --- a/packages/electron-builder/src/targets/LinuxTargetHelper.ts +++ b/packages/electron-builder/src/targets/LinuxTargetHelper.ts @@ -1,10 +1,11 @@ import BluebirdPromise from "bluebird-lst" -import { debug, exec, isEmptyOrSpaces, warn } from "electron-builder-util" -import { statOrNull } from "electron-builder-util/out/fs" -import { ensureDir, outputFile, readdir } from "fs-extra-p" +import { debug, exec, isEmptyOrSpaces, warn } from "builder-util" +import { statOrNull } from "builder-util/out/fs" +import { outputFile, readdir } from "fs-extra-p" import * as path from "path" import { LinuxPackager } from "../linuxPackager" import { LinuxBuildOptions, LinuxTargetSpecificOptions } from "../options/linuxOptions" +import { getTemplatePath } from "../util/pathManager" export const installPrefix = "/opt" @@ -49,9 +50,7 @@ export class LinuxTargetHelper { return await this.iconsFromDir(path.join(packager.buildResourcesDir, "icons")) } else { - const iconDir = await packager.getTempDir("linux.iconset") - ensureDir(iconDir) - return await this.createFromIcns(iconDir) + return await this.createFromIcns(await packager.info.tempDirManager.createTempDir({suffix: ".iconset"})) } } @@ -153,7 +152,7 @@ export class LinuxTargetHelper { private async createFromIcns(tempDir: string): Promise>> { const iconPath = await this.getIcns() if (iconPath == null) { - return await this.iconsFromDir(path.join(__dirname, "..", "..", "templates", "linux", "electron-icons")) + return await this.iconsFromDir(path.join(getTemplatePath("linux"), "electron-icons")) } if (process.platform === "darwin") { diff --git a/packages/electron-builder/src/targets/appImage.ts b/packages/electron-builder/src/targets/appImage.ts index 235865c3f8c..c6c961f0bce 100644 --- a/packages/electron-builder/src/targets/appImage.ts +++ b/packages/electron-builder/src/targets/appImage.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, exec, log } from "electron-builder-util" -import { getBin, getBinFromGithub } from "electron-builder-util/out/binDownload" -import { unlinkIfExists } from "electron-builder-util/out/fs" +import { Arch, exec, log } from "builder-util" +import { getBin, getBinFromGithub } from "builder-util/out/binDownload" +import { unlinkIfExists } from "builder-util/out/fs" import { chmod, close, createReadStream, createWriteStream, open, outputFile, readFile, write } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" @@ -9,6 +9,7 @@ import { v1 as uuid1 } from "uuid-1345" import { Target } from "../core" import { LinuxPackager } from "../linuxPackager" import { AppImageOptions } from "../options/linuxOptions" +import { getTemplatePath } from "../util/pathManager" import { LinuxTargetHelper } from "./LinuxTargetHelper" const appImageVersion = process.platform === "darwin" ? "AppImage-17-06-17-mac" : "AppImage-09-07-16-linux" @@ -16,7 +17,7 @@ const appImageVersion = process.platform === "darwin" ? "AppImage-17-06-17-mac" const appImagePathPromise = process.platform === "darwin" ? getBinFromGithub("AppImage", "17-06-17-mac", "vIaikS8Z2dEnZXKSgtcTn4gimPHCclp+v62KV2Eh9EhxvOvpDFgR3FCgdOsON4EqP8PvnfifNtxgBixCfuQU0A==") : getBin("AppImage", appImageVersion, `https://dl.bintray.com/electron-userland/bin/${appImageVersion}.7z`, "ac324e90b502f4e995f6a169451dbfc911bb55c0077e897d746838e720ae0221") const appRunTemplate = new Lazy<(data: any) => string>(async () => { - return require("ejs").compile(await readFile(path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), "utf-8")) + return require("ejs").compile(await readFile(path.join(getTemplatePath("linux"), "AppRun.sh"), "utf-8")) }) export default class AppImageTarget extends Target { diff --git a/packages/electron-builder/src/targets/appx.ts b/packages/electron-builder/src/targets/appx.ts index cc5dd7fc8fe..505efd28603 100644 --- a/packages/electron-builder/src/targets/appx.ts +++ b/packages/electron-builder/src/targets/appx.ts @@ -1,13 +1,13 @@ import BluebirdPromise from "bluebird-lst" +import { Arch, asArray, AsyncTaskManager, getArchSuffix, spawn, use } from "builder-util" +import { copyDir, copyOrLinkFile } from "builder-util/out/fs" import _debug from "debug" -import { Arch, asArray, getArchSuffix, spawn, use } from "electron-builder-util" -import { copyDir, copyOrLinkFile } from "electron-builder-util/out/fs" import { emptyDir, mkdir, readdir, readFile, writeFile } from "fs-extra-p" import * as path from "path" import { deepAssign } from "read-config-file/out/deepAssign" import { Target } from "../core" import { AppXOptions } from "../options/winOptions" -import { AsyncTaskManager } from "../util/asyncTaskManager" +import { getTemplatePath } from "../util/pathManager" import { getSignVendorPath, isOldWin6 } from "../windowsCodeSign" import { WinPackager } from "../winPackager" @@ -79,7 +79,7 @@ export default class AppXTarget extends Target { } return null })) - taskManager.addTask(this.writeManifest(path.join(__dirname, "..", "..", "templates", "appx"), preAppx, arch, publisher!, userAssets)) + taskManager.addTask(this.writeManifest(getTemplatePath("appx"), preAppx, arch, publisher!, userAssets)) taskManager.addTask(copyDir(appOutDir, path.join(preAppx, "app"))) await taskManager.awaitTasks() diff --git a/packages/electron-builder/src/targets/archive.ts b/packages/electron-builder/src/targets/archive.ts index 39240d98b73..005c2e0c12f 100644 --- a/packages/electron-builder/src/targets/archive.ts +++ b/packages/electron-builder/src/targets/archive.ts @@ -1,7 +1,7 @@ import { path7x, path7za } from "7zip-bin" -import { debug7z, debug7zArgs, isMacOsSierra, spawn } from "electron-builder-util" -import { computeEnv, getLinuxToolsPath } from "electron-builder-util/out/bundledTool" -import { exists } from "electron-builder-util/out/fs" +import { debug7z, debug7zArgs, isMacOsSierra, spawn } from "builder-util" +import { computeEnv, getLinuxToolsPath } from "builder-util/out/bundledTool" +import { exists } from "builder-util/out/fs" import { unlink } from "fs-extra-p" import * as path from "path" import { CompressionLevel } from "../core" diff --git a/packages/electron-builder/src/targets/dmg/dmg.ts b/packages/electron-builder/src/targets/dmg.ts similarity index 79% rename from packages/electron-builder/src/targets/dmg/dmg.ts rename to packages/electron-builder/src/targets/dmg.ts index bae3264d8ec..d467eca0bf6 100644 --- a/packages/electron-builder/src/targets/dmg/dmg.ts +++ b/packages/electron-builder/src/targets/dmg.ts @@ -1,22 +1,18 @@ -import BluebirdPromise from "bluebird-lst" -import { Arch, debug, exec, isEmptyOrSpaces, log, spawn, warn } from "electron-builder-util" -import { copyFile, exists, statOrNull } from "electron-builder-util/out/fs" -import { outputFile, readFile, remove, unlink } from "fs-extra-p" +import { Arch, AsyncTaskManager, debug, exec, isEmptyOrSpaces, log, spawn, warn } from "builder-util" +import { copyFile, exists, statOrNull } from "builder-util/out/fs" +import { addLicenseToDmg } from "dmg-builder/out/dmgLicense" +import { applyProperties, attachAndExecute, computeBackground, computeBackgroundColor, detach } from "dmg-builder/out/dmgUtil" +import { outputFile, remove, unlink } from "fs-extra-p" import * as path from "path" import { deepAssign } from "read-config-file/out/deepAssign" import sanitizeFileName from "sanitize-filename" -import { DmgOptions, MacOptions } from "../../options/macOptions" -import { PlatformPackager } from "../../platformPackager" -import { addLicenseToDmg } from "./dmgLicense" -import { Target } from "../../core" -import { attachAndExecute, detach } from "./dmgUtil" -import { getTemplatePath, getVendorPath } from "../../util/pathManager" +import { Target } from "../core" +import { DmgOptions, MacOptions } from "../options/macOptions" +import { PlatformPackager } from "../platformPackager" export class DmgTarget extends Target { readonly options: DmgOptions = this.packager.config.dmg || Object.create(null) - private helperDir = getTemplatePath("dmg") - constructor(private readonly packager: PlatformPackager, readonly outDir: string) { super("dmg") } @@ -64,9 +60,8 @@ export class DmgTarget extends Target { } const isContinue = await attachAndExecute(tempDmg, true, async () => { - const promises = [ - specification.background == null ? remove(`${volumePath}/.background`) : unlink(`${volumePath}/.background/DSStorePlaceHolder`), - ] + const asyncTaskManager = new AsyncTaskManager(packager.info.cancellationToken) + asyncTaskManager.addTask(specification.background == null ? remove(`${volumePath}/.background`) : unlink(`${volumePath}/.background/DSStorePlaceHolder`)) const window = specification.window! const env: any = { @@ -87,7 +82,7 @@ export class DmgTarget extends Target { } else { const volumeIcon = `${volumePath}/.VolumeIcon.icns` - promises.push(copyFile((await packager.getResource(specification.icon))!, volumeIcon)) + asyncTaskManager.addTask(copyFile((await packager.getResource(specification.icon))!, volumeIcon)) env.volumeIcon = volumeIcon } @@ -130,23 +125,10 @@ export class DmgTarget extends Target { entries += `&makeEntries("${entryName}", Iloc_xy => [ ${c.x}, ${c.y} ]),\n` if (c.type === "link") { - promises.push(exec("ln", ["-s", `/${entryPath}`, `${volumePath}/${entryName}`])) + asyncTaskManager.addTask(exec("ln", ["-s", `/${entryPath}`, `${volumePath}/${entryName}`])) } } - debug(entries) - - const dmgPropertiesFile = await packager.getTempFile("dmgProperties.pl") - - promises.push(outputFile(dmgPropertiesFile, (await readFile(path.join(this.helperDir, "dmgProperties.pl"), "utf-8")).replace("$ENTRIES", entries))) - await BluebirdPromise.all(promises) - - await exec("/usr/bin/perl", [dmgPropertiesFile], { - cwd: getVendorPath(), - env - }) - - await exec("sync") - + await applyProperties(entries, env, asyncTaskManager, packager) return packager.packagerOptions.effectiveOptionComputed == null || !(await packager.packagerOptions.effectiveOptionComputed({volumePath, specification, packager})) }) @@ -233,21 +215,10 @@ export class DmgTarget extends Target { if (specification.background != null) { throw new Error("Both dmg.backgroundColor and dmg.background are specified — please set the only one") } - - (specification as any).backgroundColor = require("parse-color")(specification.backgroundColor).hex + specification.backgroundColor = computeBackgroundColor(specification.backgroundColor) } - - if (specification.backgroundColor == null && !("background" in specification)) { - const resourceList = await packager.resourceList - if (resourceList.includes("background.tiff")) { - (specification as any).background = path.join(packager.buildResourcesDir, "background.tiff") - } - else if (resourceList.includes("background.png")) { - (specification as any).background = path.join(packager.buildResourcesDir, "background.png") - } - else { - (specification as any).background = path.join(this.helperDir, "background.tiff") - } + else if (!("background" in specification)) { + specification.background = await computeBackground(packager) } if (specification.format == null) { diff --git a/packages/electron-builder/src/targets/dmg/dmgUtil.ts b/packages/electron-builder/src/targets/dmg/dmgUtil.ts deleted file mode 100644 index 2cd04a7cbdf..00000000000 --- a/packages/electron-builder/src/targets/dmg/dmgUtil.ts +++ /dev/null @@ -1,40 +0,0 @@ -import BluebirdPromise from "bluebird-lst" -import { executeFinally } from "electron-builder-util/out/promise" -import { exec } from "electron-builder-util" - -export async function attachAndExecute(dmgPath: string, readWrite: boolean, task: () => Promise) { - //noinspection SpellCheckingInspection - const args = ["attach", "-noverify", "-noautoopen"] - if (readWrite) { - args.push("-readwrite") - } - - // otherwise hangs - // addVerboseIfNeed(args) - - args.push(dmgPath) - const attachResult = await exec("hdiutil", args, {maxBuffer: 2 * 1024 * 1024}) - const deviceResult = attachResult == null ? null : /^(\/dev\/\w+)/.exec(attachResult) - const device = deviceResult == null || deviceResult.length !== 2 ? null : deviceResult[1] - if (device == null) { - throw new Error(`Cannot mount: ${attachResult}`) - } - - return await executeFinally(task(), () => detach(device)) -} - -/** @internal */ -export async function detach(name: string) { - try { - await exec("hdiutil", ["detach", name]) - } - catch (e) { - await new BluebirdPromise((resolve, reject) => { - setTimeout(() => { - exec("hdiutil", ["detach", "-force", name]) - .then(resolve) - .catch(reject) - }, 1000) - }) - } -} \ No newline at end of file diff --git a/packages/electron-builder/src/targets/fpm.ts b/packages/electron-builder/src/targets/fpm.ts index d79e44547c2..7e3bc718a8a 100644 --- a/packages/electron-builder/src/targets/fpm.ts +++ b/packages/electron-builder/src/targets/fpm.ts @@ -1,9 +1,9 @@ import { path7x, path7za } from "7zip-bin" import BluebirdPromise from "bluebird-lst" -import { Arch, debug, exec, isMacOsSierra, log, smarten, TmpDir, toLinuxArchString, use, warn } from "electron-builder-util" -import { getBinFromGithub } from "electron-builder-util/out/binDownload" -import { computeEnv, getLinuxToolsPath } from "electron-builder-util/out/bundledTool" -import { unlinkIfExists } from "electron-builder-util/out/fs" +import { Arch, debug, exec, isMacOsSierra, log, smarten, TmpDir, toLinuxArchString, use, warn } from "builder-util" +import { getBinFromGithub } from "builder-util/out/binDownload" +import { computeEnv, getLinuxToolsPath } from "builder-util/out/bundledTool" +import { unlinkIfExists } from "builder-util/out/fs" import { ensureDir, outputFile, readFile } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" @@ -11,6 +11,7 @@ import { Target } from "../core" import * as errorMessages from "../errorMessages" import { LinuxPackager } from "../linuxPackager" import { DebOptions, LinuxTargetSpecificOptions } from "../options/linuxOptions" +import { getTemplatePath } from "../util/pathManager" import { installPrefix, LinuxTargetHelper } from "./LinuxTargetHelper" const fpmPath = new Lazy(() => { @@ -44,7 +45,7 @@ export default class FpmTarget extends Target { } private async createScripts(): Promise> { - const defaultTemplatesDir = path.join(__dirname, "..", "..", "templates", "linux") + const defaultTemplatesDir = getTemplatePath("linux") const packager = this.packager const templateOptions = { diff --git a/packages/electron-builder/src/targets/nsis/nsis.ts b/packages/electron-builder/src/targets/nsis/nsis.ts index 6cdfeea79ef..dc2969462f0 100644 --- a/packages/electron-builder/src/targets/nsis/nsis.ts +++ b/packages/electron-builder/src/targets/nsis/nsis.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" +import { Arch, asArray, AsyncTaskManager, execWine, getPlatformIconFileName, isEmptyOrSpaces, log, spawnAndWrite, use, warn } from "builder-util" +import { getBinFromGithub } from "builder-util/out/binDownload" +import { copyFile, statOrNull } from "builder-util/out/fs" import _debug from "debug" -import { Arch, asArray, execWine, getPlatformIconFileName, isEmptyOrSpaces, log, spawnAndWrite, use, warn } from "electron-builder-util" -import { getBinFromGithub } from "electron-builder-util/out/binDownload" -import { copyFile, statOrNull } from "electron-builder-util/out/fs" import { readFile } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" @@ -10,7 +10,6 @@ import sanitizeFileName from "sanitize-filename" import { v5 as uuid5 } from "uuid-1345" import { Target } from "../../core" import { normalizeExt } from "../../platformPackager" -import { AsyncTaskManager } from "../../util/asyncTaskManager" import { time } from "../../util/timer" import { WinPackager } from "../../winPackager" import { archive, ArchiveOptions } from "../archive" @@ -414,8 +413,9 @@ export class NsisTarget extends Target { args.push("-") - if (debug.enabled) { - process.stdout.write("\n\nNSIS script:\n\n" + script + "\n\n---\nEnd of NSIS script.\n\n") + const debugLogger = this.packager.info.debugLogger + if (debugLogger.enabled) { + debugLogger.add("nsis.script", script) } const nsisPath = await NSIS_PATH.value diff --git a/packages/electron-builder/src/targets/nsis/nsisLang.ts b/packages/electron-builder/src/targets/nsis/nsisLang.ts index d51b462a2e2..a7031605cb7 100644 --- a/packages/electron-builder/src/targets/nsis/nsisLang.ts +++ b/packages/electron-builder/src/targets/nsis/nsisLang.ts @@ -1,10 +1,10 @@ +import { asArray } from "builder-util" +import { bundledLanguages, langIdToName, lcid, toLangWithRegion } from "builder-util/out/langs" import _debug from "debug" -import { asArray } from "electron-builder-util" import { outputFile, readFile } from "fs-extra-p" import { safeLoad } from "js-yaml" import * as path from "path" import { PlatformPackager } from "../../platformPackager" -import { bundledLanguages, langIdToName, lcid, toLangWithRegion } from "../../util/langs" import { NsisOptions } from "./nsisOptions" import { NsisScriptGenerator } from "./nsisScriptGenerator" import { nsisTemplatesDir } from "./nsisUtil" diff --git a/packages/electron-builder/src/targets/nsis/nsisLicense.ts b/packages/electron-builder/src/targets/nsis/nsisLicense.ts index 3e2f9a899be..f0e7c18d979 100644 --- a/packages/electron-builder/src/targets/nsis/nsisLicense.ts +++ b/packages/electron-builder/src/targets/nsis/nsisLicense.ts @@ -1,7 +1,7 @@ +import { lcid } from "builder-util/out/langs" +import { getLicenseFiles } from "builder-util/out/license" import * as path from "path" -import { lcid } from "../../util/langs" import { WinPackager } from "../../winPackager" -import { getLicenseFiles } from "../license" import { NsisOptions } from "./nsisOptions" import { NsisScriptGenerator } from "./nsisScriptGenerator" import { nsisTemplatesDir } from "./nsisUtil" diff --git a/packages/electron-builder/src/targets/nsis/nsisPackage.ts b/packages/electron-builder/src/targets/nsis/nsisPackage.ts index 869a1561278..5ba861083cc 100644 --- a/packages/electron-builder/src/targets/nsis/nsisPackage.ts +++ b/packages/electron-builder/src/targets/nsis/nsisPackage.ts @@ -1,5 +1,5 @@ import { path7za } from "7zip-bin" -import { exec, spawn } from "electron-builder-util" +import { exec, spawn } from "builder-util" import { outputFile } from "fs-extra-p" import { safeDump } from "js-yaml" import * as path from "path" diff --git a/packages/electron-builder/src/targets/nsis/nsisUtil.ts b/packages/electron-builder/src/targets/nsis/nsisUtil.ts index 8fdf9432417..4c2f6e2618c 100644 --- a/packages/electron-builder/src/targets/nsis/nsisUtil.ts +++ b/packages/electron-builder/src/targets/nsis/nsisUtil.ts @@ -1,5 +1,5 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, subTask } from "electron-builder-util" +import { Arch, subTask } from "builder-util" import { unlink } from "fs-extra-p" import { NsisTarget } from "./nsis" import { getTemplatePath } from "../../util/pathManager" diff --git a/packages/electron-builder/src/targets/pkg.ts b/packages/electron-builder/src/targets/pkg.ts index 1161b03a8e6..932c0bf7b2a 100644 --- a/packages/electron-builder/src/targets/pkg.ts +++ b/packages/electron-builder/src/targets/pkg.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { Arch, debug, exec, use } from "electron-builder-util" -import { statOrNull } from "electron-builder-util/out/fs" +import { Arch, debug, exec, use } from "builder-util" +import { statOrNull } from "builder-util/out/fs" import { readFile, unlink, writeFile } from "fs-extra-p" import * as path from "path" import { findIdentity, Identity } from "../codeSign" diff --git a/packages/electron-builder/src/targets/snap.ts b/packages/electron-builder/src/targets/snap.ts index e149c161006..daacb8ba4f6 100644 --- a/packages/electron-builder/src/targets/snap.ts +++ b/packages/electron-builder/src/targets/snap.ts @@ -1,5 +1,5 @@ -import { Arch, debug, exec, log, replaceDefault, spawn, toLinuxArchString } from "electron-builder-util" -import { copyFile } from "electron-builder-util/out/fs" +import { Arch, debug, exec, log, replaceDefault, spawn, toLinuxArchString } from "builder-util" +import { copyFile } from "builder-util/out/fs" import { emptyDir, outputFile } from "fs-extra-p" import { safeDump } from "js-yaml" import { homedir } from "os" diff --git a/packages/electron-builder/src/targets/targetFactory.ts b/packages/electron-builder/src/targets/targetFactory.ts index f9dda444d5e..188cb76f1a8 100644 --- a/packages/electron-builder/src/targets/targetFactory.ts +++ b/packages/electron-builder/src/targets/targetFactory.ts @@ -1,4 +1,4 @@ -import { addValue, Arch, archFromString, ArchType, asArray } from "electron-builder-util" +import { addValue, Arch, archFromString, ArchType, asArray } from "builder-util" import { DEFAULT_TARGET, DIR_TARGET, Platform, Target, TargetConfig } from "../core" import { PlatformSpecificBuildOptions } from "../metadata" import { PlatformPackager } from "../platformPackager" diff --git a/packages/electron-builder/src/util/AppFileCopierHelper.ts b/packages/electron-builder/src/util/AppFileCopierHelper.ts index f9bd5e4981d..1003b5b7aae 100644 --- a/packages/electron-builder/src/util/AppFileCopierHelper.ts +++ b/packages/electron-builder/src/util/AppFileCopierHelper.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { debug, log } from "electron-builder-util" -import { CONCURRENCY, FileTransformer, statOrNull, walk } from "electron-builder-util/out/fs" +import { debug, log } from "builder-util" +import { CONCURRENCY, FileTransformer, statOrNull, walk } from "builder-util/out/fs" import { ensureDir, Stats } from "fs-extra-p" import * as path from "path" import { FileMatcher } from "../fileMatcher" diff --git a/packages/electron-builder/src/util/AppFileWalker.ts b/packages/electron-builder/src/util/AppFileWalker.ts index cffff72c161..9cd6a2c23ae 100644 --- a/packages/electron-builder/src/util/AppFileWalker.ts +++ b/packages/electron-builder/src/util/AppFileWalker.ts @@ -1,6 +1,5 @@ import BluebirdPromise from "bluebird-lst" -import { debug } from "electron-builder-util" -import { CONCURRENCY, FileConsumer, Filter } from "electron-builder-util/out/fs" +import { CONCURRENCY, FileConsumer, Filter } from "builder-util/out/fs" import { lstat, readdir, readlink, stat, Stats } from "fs-extra-p" import * as path from "path" import { FileMatcher } from "../fileMatcher" @@ -40,10 +39,11 @@ export class AppFileWalker implements FileConsumer { } private handleNodeModulesDir(nodeModulesDir: string, parent: string) { - return (parent === this.packager.appDir ? this.packager.productionDeps.value : getProductionDependencies(parent)) + const packager = this.packager + return (parent === packager.appDir ? packager.productionDeps.value : getProductionDependencies(parent)) .then(it => { - if (debug.enabled) { - debug(`Production dependencies in the ${parent}: ${it.filter(it => it.path.startsWith(nodeModulesDir)).map(it => path.relative(nodeModulesDir, it.path)).join(", ")}`) + if (packager.debugLogger.enabled) { + packager.debugLogger.add(`productionDependencies.${parent}`, it.filter(it => it.path.startsWith(nodeModulesDir)).map(it => path.relative(nodeModulesDir, it.path))) } return this.copyNodeModules(it, this.filter, (file, fileStat) => { diff --git a/packages/electron-builder/src/util/appFileCopier.ts b/packages/electron-builder/src/util/appFileCopier.ts index 6bb45cab0f5..a8af6e6eb4f 100644 --- a/packages/electron-builder/src/util/appFileCopier.ts +++ b/packages/electron-builder/src/util/appFileCopier.ts @@ -1,11 +1,11 @@ import BluebirdPromise from "bluebird-lst" -import { CONCURRENCY, FileCopier, Link, MAX_FILE_REQUESTS } from "electron-builder-util/out/fs" +import { AsyncTaskManager } from "builder-util" +import { CONCURRENCY, FileCopier, Link, MAX_FILE_REQUESTS } from "builder-util/out/fs" import { ensureDir, readlink, symlink } from "fs-extra-p" import * as path from "path" import { Packager } from "../packager" import { ensureEndSlash, FileSet } from "./AppFileCopierHelper" import { copyFileOrData } from "./asarUtil" -import { AsyncTaskManager } from "./asyncTaskManager" export async function copyAppFiles(fileSet: FileSet, packager: Packager) { const metadata = fileSet.metadata diff --git a/packages/electron-builder/src/util/asarUtil.ts b/packages/electron-builder/src/util/asarUtil.ts index 21416fbab28..ff447a54c30 100644 --- a/packages/electron-builder/src/util/asarUtil.ts +++ b/packages/electron-builder/src/util/asarUtil.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { debug, log } from "electron-builder-util" -import { CONCURRENCY, FileCopier, Filter, MAX_FILE_REQUESTS, statOrNull } from "electron-builder-util/out/fs" +import { AsyncTaskManager, debug, log } from "builder-util" +import { CONCURRENCY, FileCopier, Filter, MAX_FILE_REQUESTS, statOrNull } from "builder-util/out/fs" import { createReadStream, createWriteStream, ensureDir, readFile, Stats, writeFile } from "fs-extra-p" import * as path from "path" import { AsarFilesystem, Node, readAsar } from "../asar" @@ -8,7 +8,6 @@ import { AsarOptions } from "../metadata" import { Packager } from "../packager" import { PlatformPackager } from "../platformPackager" import { ensureEndSlash, FileSet, NODE_MODULES_PATTERN } from "./AppFileCopierHelper" -import { AsyncTaskManager } from "./asyncTaskManager" const isBinaryFile: any = BluebirdPromise.promisify(require("isbinaryfile")) const pickle = require("chromium-pickle-js") diff --git a/packages/electron-builder/src/util/cacheManager.ts b/packages/electron-builder/src/util/cacheManager.ts index 019e8275d8a..8c0adc4a096 100644 --- a/packages/electron-builder/src/util/cacheManager.ts +++ b/packages/electron-builder/src/util/cacheManager.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" import { Hash } from "crypto" -import { Arch, debug, warn } from "electron-builder-util" -import { copyFile } from "electron-builder-util/out/fs" -import { orNullIfFileNotExist } from "electron-builder-util/out/promise" +import { Arch, debug, warn } from "builder-util" +import { copyFile } from "builder-util/out/fs" +import { orNullIfFileNotExist } from "builder-util/out/promise" import { ensureDir, readFile, readJson, writeJson } from "fs-extra-p" import * as path from "path" @@ -37,7 +37,7 @@ export class BuildCacheManager { return false } - debug(`Copy cached executable to ${this.executableFile}`) + debug(`Copy cached ${this.cacheFile} executable to ${this.executableFile}`) try { await copyFile(this.cacheFile, this.executableFile, false) return true diff --git a/packages/electron-builder/src/util/config.ts b/packages/electron-builder/src/util/config.ts index 17fc550f504..0a360be5ec0 100644 --- a/packages/electron-builder/src/util/config.ts +++ b/packages/electron-builder/src/util/config.ts @@ -1,6 +1,6 @@ import Ajv, { AdditionalPropertiesParams, ErrorObject, TypeParams } from "ajv" -import { asArray, debug, log, warn } from "electron-builder-util" -import { statOrNull } from "electron-builder-util/out/fs" +import { asArray, debug, log, warn } from "builder-util" +import { statOrNull } from "builder-util/out/fs" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" diff --git a/packages/electron-builder/src/util/electronVersion.ts b/packages/electron-builder/src/util/electronVersion.ts index efb036d24c0..caa21ef30d5 100644 --- a/packages/electron-builder/src/util/electronVersion.ts +++ b/packages/electron-builder/src/util/electronVersion.ts @@ -1,5 +1,5 @@ -import { warn } from "electron-builder-util" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { warn } from "builder-util" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" diff --git a/packages/electron-builder/src/util/filter.ts b/packages/electron-builder/src/util/filter.ts index b8479ebae71..f099b349f3b 100644 --- a/packages/electron-builder/src/util/filter.ts +++ b/packages/electron-builder/src/util/filter.ts @@ -1,4 +1,4 @@ -import { Filter } from "electron-builder-util/out/fs" +import { Filter } from "builder-util/out/fs" import { Stats } from "fs-extra-p" import { Minimatch } from "minimatch" import * as path from "path" diff --git a/packages/electron-builder/src/util/flags.ts b/packages/electron-builder/src/util/flags.ts index a4bb6fcd43c..9326ccb5da7 100644 --- a/packages/electron-builder/src/util/flags.ts +++ b/packages/electron-builder/src/util/flags.ts @@ -1,4 +1,4 @@ -import { isEnvTrue } from "electron-builder-util" +import { isEnvTrue } from "builder-util" export function isUseSystemSigncode() { return isEnvTrue(process.env.USE_SYSTEM_SIGNCODE) diff --git a/packages/electron-builder/src/util/packageDependencies.ts b/packages/electron-builder/src/util/packageDependencies.ts index a6fcdb533ca..a3040eb416d 100644 --- a/packages/electron-builder/src/util/packageDependencies.ts +++ b/packages/electron-builder/src/util/packageDependencies.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" -import { debug } from "electron-builder-util" -import { CONCURRENCY } from "electron-builder-util/out/fs" -import { orNullIfFileNotExist } from "electron-builder-util/out/promise" +import { debug } from "builder-util" +import { CONCURRENCY } from "builder-util/out/fs" +import { orNullIfFileNotExist } from "builder-util/out/promise" import { lstat, readdir, readFile, realpath, Stats } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" @@ -36,7 +36,7 @@ const knownAlwaysIgnoredDevDeps = new Set([ if (process.env.ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY !== "true") { knownAlwaysIgnoredDevDeps.add("electron-builder") - knownAlwaysIgnoredDevDeps.add("electron-builder-util") + knownAlwaysIgnoredDevDeps.add("builder-util") knownAlwaysIgnoredDevDeps.add("electron-publish") knownAlwaysIgnoredDevDeps.add("electron-download-tf") } diff --git a/packages/electron-builder/src/util/packageMetadata.ts b/packages/electron-builder/src/util/packageMetadata.ts index d9ed41f652b..3385e4d8815 100644 --- a/packages/electron-builder/src/util/packageMetadata.ts +++ b/packages/electron-builder/src/util/packageMetadata.ts @@ -1,4 +1,4 @@ -import { isEmptyOrSpaces, log, warn } from "electron-builder-util" +import { isEmptyOrSpaces, log, warn } from "builder-util" import { readFile, readJson } from "fs-extra-p" import * as path from "path" import { Metadata } from "../metadata" diff --git a/packages/electron-builder/src/util/repositoryInfo.ts b/packages/electron-builder/src/util/repositoryInfo.ts index b09371ec977..a2c80bc2c58 100644 --- a/packages/electron-builder/src/util/repositoryInfo.ts +++ b/packages/electron-builder/src/util/repositoryInfo.ts @@ -1,4 +1,4 @@ -import { orNullIfFileNotExist } from "electron-builder-util/out/promise" +import { orNullIfFileNotExist } from "builder-util/out/promise" import { readFile } from "fs-extra-p" import { fromUrl, Info } from "hosted-git-info" import * as path from "path" diff --git a/packages/electron-builder/src/util/timer.ts b/packages/electron-builder/src/util/timer.ts index d7a962bb8b4..0fc3e27c666 100644 --- a/packages/electron-builder/src/util/timer.ts +++ b/packages/electron-builder/src/util/timer.ts @@ -1,4 +1,4 @@ -import { debug } from "electron-builder-util" +import { debug } from "builder-util" export interface Timer { end(): void diff --git a/packages/electron-builder/src/util/yarn.ts b/packages/electron-builder/src/util/yarn.ts index 752471621bd..4213c066913 100644 --- a/packages/electron-builder/src/util/yarn.ts +++ b/packages/electron-builder/src/util/yarn.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { asArray, log, spawn, warn } from "electron-builder-util" -import { exists } from "electron-builder-util/out/fs" +import { asArray, log, spawn, warn } from "builder-util" +import { exists } from "builder-util/out/fs" import { Lazy } from "lazy-val" import { homedir } from "os" import * as path from "path" diff --git a/packages/electron-builder/src/winPackager.ts b/packages/electron-builder/src/winPackager.ts index b63af41ec36..b96bdca2181 100644 --- a/packages/electron-builder/src/winPackager.ts +++ b/packages/electron-builder/src/winPackager.ts @@ -2,7 +2,7 @@ import BluebirdPromise from "bluebird-lst" import { createHash } from "crypto" import _debug from "debug" import { parseDn } from "electron-builder-http/out/rfc2253Parser" -import { Arch, asArray, exec, execWine, log, use, warn } from "electron-builder-util" +import { Arch, asArray, exec, execWine, log, use, warn } from "builder-util" import { close, open, read, rename } from "fs-extra-p" import isCI from "is-ci" import { Lazy } from "lazy-val" diff --git a/packages/electron-builder/src/windowsCodeSign.ts b/packages/electron-builder/src/windowsCodeSign.ts index 8a0ae0b228d..d349f1c97b2 100644 --- a/packages/electron-builder/src/windowsCodeSign.ts +++ b/packages/electron-builder/src/windowsCodeSign.ts @@ -1,6 +1,6 @@ -import { exec, isMacOsSierra, warn } from "electron-builder-util" -import { getBinFromGithub } from "electron-builder-util/out/binDownload" -import { computeToolEnv, ToolInfo } from "electron-builder-util/out/bundledTool" +import { exec, isMacOsSierra, warn } from "builder-util" +import { getBinFromGithub } from "builder-util/out/binDownload" +import { computeToolEnv, ToolInfo } from "builder-util/out/bundledTool" import { rename } from "fs-extra-p" import isCi from "is-ci" import * as os from "os" diff --git a/packages/electron-publish/package.json b/packages/electron-publish/package.json index fb7948f6df6..af970ec2ac1 100644 --- a/packages/electron-publish/package.json +++ b/packages/electron-publish/package.json @@ -15,7 +15,7 @@ "mime": "^1.3.6", "bluebird-lst": "^1.0.3", "electron-builder-http": "~0.0.0-semantic-release", - "electron-builder-util": "~0.0.0-semantic-release", + "builder-util": "^0.0.0-semantic-release", "chalk": "^2.1.0" }, "typings": "./out/publisher.d.ts" diff --git a/packages/electron-publish/src/BintrayPublisher.ts b/packages/electron-publish/src/BintrayPublisher.ts index 823bbebe0c9..1197f138622 100644 --- a/packages/electron-publish/src/BintrayPublisher.ts +++ b/packages/electron-publish/src/BintrayPublisher.ts @@ -2,8 +2,8 @@ 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" -import { Arch, debug, isEmptyOrSpaces, isTokenCharValid, log, toLinuxArchString } from "electron-builder-util" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { Arch, debug, isEmptyOrSpaces, isTokenCharValid, log, toLinuxArchString } from "builder-util" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { ClientRequest, RequestOptions } from "http" import { HttpPublisher, PublishContext, PublishOptions } from "./publisher" diff --git a/packages/electron-publish/src/gitHubPublisher.ts b/packages/electron-publish/src/gitHubPublisher.ts index 272c2ef38f2..385cb7b2523 100644 --- a/packages/electron-publish/src/gitHubPublisher.ts +++ b/packages/electron-publish/src/gitHubPublisher.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" import { configureRequestOptions, HttpError, parseJson } from "electron-builder-http" import { GithubOptions } from "electron-builder-http/out/publishOptions" -import { Arch, debug, isEmptyOrSpaces, isTokenCharValid, log, warn } from "electron-builder-util" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { Arch, debug, isEmptyOrSpaces, isTokenCharValid, log, warn } from "builder-util" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { ClientRequest } from "http" import mime from "mime" import { parse as parseUrl } from "url" diff --git a/packages/electron-publish/src/multiProgress.ts b/packages/electron-publish/src/multiProgress.ts index 6f6803e3d35..f78007fcca1 100644 --- a/packages/electron-publish/src/multiProgress.ts +++ b/packages/electron-publish/src/multiProgress.ts @@ -1,4 +1,4 @@ -import { setPrinter } from "electron-builder-util/out/log" +import { setPrinter } from "builder-util/out/log" import { ProgressBar } from "./progress" export class MultiProgress { diff --git a/packages/electron-publish/src/publisher.ts b/packages/electron-publish/src/publisher.ts index 4a8005f46fa..02fc136892e 100644 --- a/packages/electron-publish/src/publisher.ts +++ b/packages/electron-publish/src/publisher.ts @@ -1,6 +1,6 @@ import { green } from "chalk" import { CancellationToken, ProgressCallbackTransform } from "electron-builder-http" -import { Arch, log } from "electron-builder-util" +import { Arch, log } from "builder-util" import { createReadStream, stat, Stats } from "fs-extra-p" import { ClientRequest } from "http" import { basename } from "path" diff --git a/packages/electron-publish/tsconfig.json b/packages/electron-publish/tsconfig.json index e68de1019bc..00358fc6f63 100644 --- a/packages/electron-publish/tsconfig.json +++ b/packages/electron-publish/tsconfig.json @@ -12,7 +12,6 @@ ], "files": [ "../../typings/mime.d.ts", - "../../typings/debug.d.ts", "../../typings/chalk.d.ts" ] } \ No newline at end of file diff --git a/packages/electron-publisher-s3/package.json b/packages/electron-publisher-s3/package.json index c10cb91ccd0..751cc1dd9e2 100644 --- a/packages/electron-publisher-s3/package.json +++ b/packages/electron-publisher-s3/package.json @@ -15,7 +15,7 @@ "aws-sdk": "^2.101.0", "mime": "^1.3.6", "electron-publish": "~0.0.0-semantic-release", - "electron-builder-util": "~0.0.0-semantic-release", + "builder-util": "^0.0.0-semantic-release", "bluebird-lst": "^1.0.3" }, "typings": "./out/s3Publisher.d.ts" diff --git a/packages/electron-publisher-s3/src/s3Publisher.ts b/packages/electron-publisher-s3/src/s3Publisher.ts index 58bf06ec82f..864e89e5d58 100644 --- a/packages/electron-publisher-s3/src/s3Publisher.ts +++ b/packages/electron-publisher-s3/src/s3Publisher.ts @@ -1,7 +1,7 @@ import { S3 } from "aws-sdk" import { CreateMultipartUploadRequest, ObjectCannedACL, StorageClass } from "aws-sdk/clients/s3" import { S3Options } from "electron-builder-http/out/publishOptions" -import { Arch, debug } from "electron-builder-util" +import { Arch, debug } from "builder-util" import { PublishContext, Publisher } from "electron-publish" import { ProgressCallback } from "electron-publish/out/progress" import { ensureDir, stat, symlink } from "fs-extra-p" diff --git a/packages/electron-publisher-s3/tsconfig.json b/packages/electron-publisher-s3/tsconfig.json index 39b1b430e2e..1acefade48c 100644 --- a/packages/electron-publisher-s3/tsconfig.json +++ b/packages/electron-publisher-s3/tsconfig.json @@ -7,7 +7,6 @@ "src/**/*.ts" ], "files": [ - "../../typings/mime.d.ts", - "../../typings/debug.d.ts" + "../../typings/mime.d.ts" ] } \ No newline at end of file diff --git a/packages/electron-updater/tsconfig.json b/packages/electron-updater/tsconfig.json index 4b6d637c4bf..b183c94fa6a 100644 --- a/packages/electron-updater/tsconfig.json +++ b/packages/electron-updater/tsconfig.json @@ -10,7 +10,6 @@ }, "files": [ "../../typings/semver.d.ts", - "../../typings/debug.d.ts", "../../typings/electron.d.ts", "../../typings/uuid-1345.d.ts" ], diff --git a/scripts/jsdoc/helpers.js b/scripts/jsdoc/helpers.js index 33be107cbaa..7f8869bc14d 100644 --- a/scripts/jsdoc/helpers.js +++ b/scripts/jsdoc/helpers.js @@ -260,8 +260,8 @@ function identifierToLink(id, root) { let linked = resolveById(id) if (linked == null) { - if (id === "module:electron-builder/out/core.Arch" || id === "module:electron-builder-util/out/arch.Arch") { - id = "module:electron-builder-util.Arch" + if (id === "module:electron-builder/out/core.Arch" || id === "module:builder-util/out/arch.Arch") { + id = "module:builder-util.Arch" } else if (id === "module:electron-builder-http/out/CancellationToken.CancellationToken") { id = "module:electron-builder-http.CancellationToken" diff --git a/scripts/jsdoc2md.js b/scripts/jsdoc2md.js index c693956a21b..6825b94d567 100644 --- a/scripts/jsdoc2md.js +++ b/scripts/jsdoc2md.js @@ -37,7 +37,7 @@ async function main() { const developerFiles = (await globby([ "builder/electron-builder-out-appInfo.js", "builder/electron-builder-out-core.js", - "util/electron-builder-util.js", + "util/builder-util.js", ], {cwd: source})) .filter(it => !userFiles.includes(it)) @@ -84,9 +84,9 @@ function sortOptions(pages) { return false }) - // move Arch from electron-builder-util to electron-builder + // move Arch from builder-util to electron-builder pages[1].data = pages[1].data.filter(member => { - if (!member.id.startsWith("module:electron-builder-util")) { + if (!member.id.startsWith("module:builder-util")) { return true } diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index 5b68df0fdec..13642f5d8a5 100755 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -5,7 +5,7 @@ ln -f README.md packages/electron-builder/README.md npm publish packages/asar-integrity || true npm publish packages/electron-builder-http || true -npm publish packages/electron-builder-util || true +npm publish packages/builder-util || true npm publish packages/electron-publish || true npm publish packages/electron-publisher-s3 || true npm publish packages/electron-builder || true diff --git a/test/src/ArtifactPublisherTest.ts b/test/src/ArtifactPublisherTest.ts index b57d2ed7b87..61d22a06c60 100644 --- a/test/src/ArtifactPublisherTest.ts +++ b/test/src/ArtifactPublisherTest.ts @@ -1,7 +1,7 @@ import { CancellationToken, HttpError } from "electron-builder-http" import { S3Options } from "electron-builder-http/out/publishOptions" -import { Arch, TmpDir } from "electron-builder-util" -import { copyFile } from "electron-builder-util/out/fs" +import { Arch, TmpDir } from "builder-util" +import { copyFile } from "builder-util/out/fs" import { createPublisher } from "electron-builder/out/publish/PublishManager" import { PublishContext } from "electron-publish" import { BintrayPublisher } from "electron-publish/out/BintrayPublisher" diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts index f0e9dbca2dd..97c8c42451d 100644 --- a/test/src/BuildTest.ts +++ b/test/src/BuildTest.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" import { Arch, createTargets, DIR_TARGET, Platform } from "electron-builder" -import { walk } from "electron-builder-util/out/fs" -import { checkWineVersion } from "electron-builder-util/out/wine" +import { walk } from "builder-util/out/fs" +import { checkWineVersion } from "builder-util/out/wine" import { readAsarJson } from "electron-builder/out/asar" import { move, outputJson, readJson } from "fs-extra-p" import * as path from "path" diff --git a/test/src/filesTest.ts b/test/src/filesTest.ts index ddca602a5e1..ba669550121 100644 --- a/test/src/filesTest.ts +++ b/test/src/filesTest.ts @@ -1,7 +1,7 @@ import BluebirdPromise from "bluebird-lst" import { DIR_TARGET, Platform } from "electron-builder" -import { TmpDir } from "electron-builder-util" -import { copyDir } from "electron-builder-util/out/fs" +import { TmpDir } from "builder-util" +import { copyDir } from "builder-util/out/fs" import { outputFile, readFile, stat, symlink } from "fs-extra-p" import * as path from "path" import Mode, { Permissions } from "stat-mode" diff --git a/test/src/helpers/CheckingPackager.ts b/test/src/helpers/CheckingPackager.ts index 06df039f382..8b4cb39ccdd 100644 --- a/test/src/helpers/CheckingPackager.ts +++ b/test/src/helpers/CheckingPackager.ts @@ -1,9 +1,9 @@ +import { AsyncTaskManager } from "builder-util" import { Arch, MacOptions, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "electron-builder/out/codeSign" import MacPackager from "electron-builder/out/macPackager" -import { DmgTarget } from "electron-builder/out/targets/dmg/dmg" -import { AsyncTaskManager } from "electron-builder/out/util/asyncTaskManager" +import { DmgTarget } from "electron-builder/out/targets/dmg" import { SignOptions } from "electron-builder/out/windowsCodeSign" import { WinPackager } from "electron-builder/out/winPackager" import { SignOptions as MacSignOptions } from "electron-osx-sign" @@ -48,7 +48,7 @@ export class CheckingMacPackager extends MacPackager { for (const target of targets) { // do not use instanceof to avoid dmg require if (target.name === "dmg") { - this.effectiveDistOptions = await (target).computeDmgOptions() + this.effectiveDistOptions = await (target as DmgTarget).computeDmgOptions() break } } diff --git a/test/src/helpers/checkDeps.ts b/test/src/helpers/checkDeps.ts index aa54c1c32e8..9fabda36d46 100644 --- a/test/src/helpers/checkDeps.ts +++ b/test/src/helpers/checkDeps.ts @@ -6,7 +6,7 @@ import * as path from "path" require("v8-compile-cache") -const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit +const printErrorAndExit = require("../../../packages/builder-util/out/promise").printErrorAndExit const knownUnusedDevDependencies = new Set([ ]) diff --git a/test/src/helpers/fileAssert.ts b/test/src/helpers/fileAssert.ts index 31deba7f3ba..9ce7a8c7701 100644 --- a/test/src/helpers/fileAssert.ts +++ b/test/src/helpers/fileAssert.ts @@ -1,4 +1,4 @@ -import { exists } from "electron-builder-util/out/fs" +import { exists } from "builder-util/out/fs" import { lstat, stat } from "fs-extra-p" import * as path from "path" diff --git a/test/src/helpers/lint.ts b/test/src/helpers/lint.ts index cda488a3cb0..64bd4877c4b 100644 --- a/test/src/helpers/lint.ts +++ b/test/src/helpers/lint.ts @@ -3,7 +3,7 @@ import * as path from "path" const workerFarm = require("worker-farm") -const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit +const printErrorAndExit = require("../../../packages/builder-util/out/promise").printErrorAndExit const rootDir = path.join(__dirname, "../../..") const packageDir = path.join(rootDir, "packages") diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index cd88580eb61..2ba61f28e52 100644 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -4,10 +4,10 @@ import DecompressZip from "decompress-zip" import { Arch, ArtifactCreated, DIR_TARGET, getArchSuffix, MacOsTargetName, Packager, PackagerOptions, Platform, Target } from "electron-builder" import { CancellationToken } from "electron-builder-http" import { convertVersion } from "electron-builder-squirrel-windows/out/squirrelPack" -import { addValue, exec, log, spawn, warn } from "electron-builder-util" -import { getLinuxToolsPath } from "electron-builder-util/out/bundledTool" -import { copyDir, FileCopier } from "electron-builder-util/out/fs" -import { executeFinally } from "electron-builder-util/out/promise" +import { addValue, exec, log, spawn, warn } from "builder-util" +import { getLinuxToolsPath } from "builder-util/out/bundledTool" +import { copyDir, FileCopier } from "builder-util/out/fs" +import { executeFinally } from "builder-util/out/promise" import { PublishManager } from "electron-builder/out/publish/PublishManager" import { computeArchToTargetNamesMap } from "electron-builder/out/targets/targetFactory" import { PublishPolicy } from "electron-publish" @@ -20,7 +20,7 @@ import { deepAssign } from "read-config-file/out/deepAssign" import { TmpDir } from "temp-file" import { CSC_LINK, WIN_CSC_LINK } from "./codeSignData" import { assertThat } from "./fileAssert" -import { walk } from "electron-builder-util/out/fs" +import { walk } from "builder-util/out/fs" if (process.env.TRAVIS !== "true") { process.env.CIRCLE_BUILD_NUM = "42" diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts index ad155f25692..4f034467582 100644 --- a/test/src/helpers/runTests.ts +++ b/test/src/helpers/runTests.ts @@ -7,7 +7,7 @@ import * as path from "path" import { ELECTRON_VERSION } from "./testConfig" // 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 util = require("../../../packages/builder-util/out/util") const isEmptyOrSpaces = util.isEmptyOrSpaces const downloadElectron: (options: any) => Promise = BluebirdPromise.promisify(require("electron-download-tf")) diff --git a/test/src/helpers/setVersions.ts b/test/src/helpers/setVersions.ts index 180fd5455a5..88416daa44a 100644 --- a/test/src/helpers/setVersions.ts +++ b/test/src/helpers/setVersions.ts @@ -3,8 +3,8 @@ import { readdir, readJson, writeJson } from "fs-extra-p" import * as path from "path" import * as semver from "semver" -const printErrorAndExit = require("../../../packages/electron-builder-util/out/promise").printErrorAndExit -const exec = require("../../../packages/electron-builder-util/out/util").exec +const printErrorAndExit = require("../../../packages/builder-util/out/promise").printErrorAndExit +const exec = require("../../../packages/builder-util/out/util").exec const rootDir = path.join(__dirname, "../../..") const packageDir = path.join(rootDir, "packages") @@ -75,7 +75,7 @@ async function setDepVersions(packages: Array, packageData: Array) } const newVersion = versions[depIndex] - if (oldVersion == newVersion || newVersion === "0.0.0-semantic-release") { + if (oldVersion === newVersion || newVersion === "0.0.0-semantic-release") { console.log(`Skip ${depPackageName} for ${packageName} — version ${newVersion} is actual`) continue } diff --git a/test/src/helpers/updaterTestUtil.ts b/test/src/helpers/updaterTestUtil.ts index ca340cc1839..36e0d1f8ce7 100644 --- a/test/src/helpers/updaterTestUtil.ts +++ b/test/src/helpers/updaterTestUtil.ts @@ -1,6 +1,6 @@ import { BintrayOptions, GenericServerOptions, GithubOptions } from "electron-builder-http/out/publishOptions" -import { TmpDir } from "electron-builder-util" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { TmpDir } from "builder-util" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { AppUpdater, NoOpLogger } from "electron-updater/out/AppUpdater" import { MacUpdater } from "electron-updater/out/MacUpdater" import { outputFile } from "fs-extra-p" diff --git a/test/src/helpers/winHelper.ts b/test/src/helpers/winHelper.ts index c62ef7b40c8..b567eed72f7 100644 --- a/test/src/helpers/winHelper.ts +++ b/test/src/helpers/winHelper.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" import { Arch, Platform } from "electron-builder" -import { walk } from "electron-builder-util/out/fs" +import { walk } from "builder-util/out/fs" import { readAsarJson } from "electron-builder/out/asar" import { outputFile, readFile } from "fs-extra-p" import { safeLoad } from "js-yaml" diff --git a/test/src/helpers/wine.ts b/test/src/helpers/wine.ts index 3c9a2e174b6..f975623337e 100644 --- a/test/src/helpers/wine.ts +++ b/test/src/helpers/wine.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { exec, safeStringifyJson } from "electron-builder-util" -import { unlinkIfExists } from "electron-builder-util/out/fs" +import { exec, safeStringifyJson } from "builder-util" +import { unlinkIfExists } from "builder-util/out/fs" import { emptyDir, ensureDir, readFile, writeFile } from "fs-extra-p" import { homedir } from "os" import * as path from "path" diff --git a/test/src/httpRequestTest.ts b/test/src/httpRequestTest.ts index 456d93d689d..756ed1a3d2a 100644 --- a/test/src/httpRequestTest.ts +++ b/test/src/httpRequestTest.ts @@ -1,5 +1,5 @@ import { randomBytes } from "crypto" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { tmpdir } from "os" import * as path from "path" import { assertThat } from "./helpers/fileAssert" diff --git a/test/src/mac/CodeSignTest.ts b/test/src/mac/CodeSignTest.ts index 2515ccb1e7a..049e2031482 100644 --- a/test/src/mac/CodeSignTest.ts +++ b/test/src/mac/CodeSignTest.ts @@ -1,4 +1,4 @@ -import { removePassword, TmpDir } from "electron-builder-util" +import { removePassword, TmpDir } from "builder-util" import { createKeychain } from "electron-builder/out/codeSign" import { CSC_LINK } from "../helpers/codeSignData" diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts index bfc1cb95a95..7df001e441c 100644 --- a/test/src/mac/dmgTest.ts +++ b/test/src/mac/dmgTest.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" +import { copyFile } from "builder-util/out/fs" +import { attachAndExecute, getDmgTemplatePath } from "dmg-builder/out/dmgUtil" import { Platform } from "electron-builder" -import { copyFile } from "electron-builder-util/out/fs" import { PlatformPackager } from "electron-builder/out/platformPackager" -import { attachAndExecute } from "electron-builder/out/targets/dmg/dmgUtil" import { remove, writeFile } from "fs-extra-p" import * as path from "path" import { assertThat } from "../helpers/fileAssert" @@ -48,7 +48,7 @@ test.ifAll.ifMac("custom background - new way", () => { }, }, { projectDirCreated: projectDir => BluebirdPromise.all([ - copyFile(path.join(__dirname, "..", "..", "..", "packages", "electron-builder", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)), + copyFile(path.join(getDmgTemplatePath(), "background.tiff"), path.join(projectDir, customBackground)), // copy, but not rename to test that default icon is not used copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "customIcon.icns")), copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "foo.icns")), diff --git a/test/src/mac/macArchiveTest.ts b/test/src/mac/macArchiveTest.ts index 8b5cda9cd07..abe5ad6a422 100644 --- a/test/src/mac/macArchiveTest.ts +++ b/test/src/mac/macArchiveTest.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" import { Platform } from "electron-builder" -import { exec } from "electron-builder-util" +import { exec } from "builder-util" import { readFile, symlink } from "fs-extra-p" import * as path from "path" import pathSorter from "path-sort" diff --git a/test/src/mac/macPackagerTest.ts b/test/src/mac/macPackagerTest.ts index 81017c8cb97..a7b65ebd619 100644 --- a/test/src/mac/macPackagerTest.ts +++ b/test/src/mac/macPackagerTest.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" import { createTargets, DIR_TARGET, Platform } from "electron-builder" -import { copyOrLinkFile } from "electron-builder-util/out/fs" +import { copyOrLinkFile } from "builder-util/out/fs" import { readJson } from "fs-extra-p" import * as path from "path" import { assertThat } from "../helpers/fileAssert" diff --git a/test/src/updater/macUpdaterTest.ts b/test/src/updater/macUpdaterTest.ts index ddd9270c70e..a4ab19fe9b1 100644 --- a/test/src/updater/macUpdaterTest.ts +++ b/test/src/updater/macUpdaterTest.ts @@ -1,5 +1,5 @@ import { GithubOptions } from "electron-builder-http/out/publishOptions" -import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" +import { httpExecutor } from "builder-util/out/nodeHttpExecutor" import { MacUpdater } from "electron-updater/out/MacUpdater" import { EventEmitter } from "events" import { parse as parseUrl } from "url" diff --git a/typings/debug.d.ts b/typings/debug.d.ts deleted file mode 100644 index 0ad1e465305..00000000000 --- a/typings/debug.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module "debug" { - export default function debug(namespace: string): debug.Debugger -} - -declare namespace debug { - export interface Debugger { - (formatter: any, ...args: any[]): void - - enabled: boolean; - log: Function; - namespace: string; - } -} \ No newline at end of file diff --git a/typings/sanitize-filename.d.ts b/typings/sanitize-filename.d.ts deleted file mode 100644 index 51ca2eb05b2..00000000000 --- a/typings/sanitize-filename.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module "sanitize-filename" { - function sanitize(name: string): string - - export default sanitize -} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index eed72a32f02..325484a7b1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,6 +22,10 @@ "7zip-bin-mac" "^1.0.1" "7zip-bin-win" "^2.1.0" +"@types/debug@^0.0.30": + version "0.0.30" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-0.0.30.tgz#dc1e40f7af3b9c815013a7860e6252f6352a84df" + "@types/dotenv@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/dotenv/-/dotenv-4.0.1.tgz#a0db2a2d25b5c01ff387f07c4f1e002d592873e8" @@ -32,9 +36,9 @@ version "1.3.29" resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.29.tgz#1325e981e047d40d13ce0359b821475b97741d2f" -"@types/jest@^20.0.7": - version "20.0.7" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-20.0.7.tgz#39cd215db8bda03928dceb933a1e63eb2cbd210e" +"@types/jest@^20.0.8": + version "20.0.8" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-20.0.8.tgz#7f8c97f73d20d3bf5448fbe33661a342002b5954" "@types/js-yaml@^3.9.1": version "3.9.1" @@ -44,6 +48,10 @@ version "8.0.24" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1" +"@types/sanitize-filename@^1.1.28": + version "1.1.28" + resolved "https://registry.yarnpkg.com/@types/sanitize-filename/-/sanitize-filename-1.1.28.tgz#baa18f5ce4330fcbb3ea7b62f65550963d9aaa07" + "@types/source-map-support@^0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.0.tgz#a62a1866614af68c888173c001481f242aaf148b" @@ -3388,9 +3396,9 @@ truncate-utf8-bytes@^1.0.0: dependencies: utf8-byte-length "^1.0.1" -ts-babel@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/ts-babel/-/ts-babel-4.0.1.tgz#d8c822858d38b11ba87942653ceaaf8c51eb48ed" +ts-babel@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ts-babel/-/ts-babel-4.1.3.tgz#2bbf0efcfe7af496292e4c97b7df9e5d42eb1da5" dependencies: babel-core "^6.26.0" bluebird-lst "^1.0.3" @@ -3708,10 +3716,6 @@ write-file-atomic@^2.0.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -x-mac-cyrillic@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/x-mac-cyrillic/-/x-mac-cyrillic-1.0.0.tgz#43f111038ab51d766d0beb4ce5d283c1826f9bc9" - xdg-basedir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"