From c03ad3851cf8849ef59c1f78898bbebe8a715c6f Mon Sep 17 00:00:00 2001 From: develar Date: Mon, 5 Mar 2018 20:23:49 +0100 Subject: [PATCH] feat: validate icon permissions Close #2654 --- package.json | 4 +- packages/builder-util/package.json | 4 +- packages/builder-util/src/DebugLogger.ts | 3 +- packages/builder-util/src/asyncTaskManager.ts | 2 +- packages/dmg-builder/package.json | 2 +- packages/electron-builder-lib/package.json | 4 +- .../electron-builder-lib/src/fileMatcher.ts | 2 +- packages/electron-builder-lib/src/packager.ts | 2 +- .../src/remoteBuilder/RemoteBuilder.ts | 2 +- .../src/targets/nsis/nsisUtil.ts | 2 +- .../src/cli/install-app-deps.ts | 2 +- packages/electron-updater/package.json | 2 +- packages/electron-updater/src/AppUpdater.ts | 3 +- .../differentialDownloader/DataSplitter.ts | 7 ++-- test/src/BuildTest.ts | 8 ++-- test/src/helpers/downloadElectron.ts | 2 +- test/src/helpers/winHelper.ts | 3 +- test/src/mac/masTest.ts | 6 +-- yarn.lock | 37 +++++++++++-------- 19 files changed, 50 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 360c72b5262..644a823959f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).", "dependencies": { "7zip-bin": "~3.1.0", - "app-builder-bin": "1.6.0", + "app-builder-bin": "1.7.0", "archiver": "^2.1.1", "async-exit-hook": "^2.0.1", "aws-sdk": "^2.205.0", @@ -48,7 +48,7 @@ "ini": "^1.3.5", "is-ci": "^1.1.0", "isbinaryfile": "^3.0.2", - "js-yaml": "^3.10.0", + "js-yaml": "^3.11.0", "lazy-val": "^1.0.3", "lodash.isequal": "^4.5.0", "mime": "^2.2.0", diff --git a/packages/builder-util/package.json b/packages/builder-util/package.json index 51e87987537..690f8d287bf 100644 --- a/packages/builder-util/package.json +++ b/packages/builder-util/package.json @@ -11,7 +11,7 @@ "out" ], "dependencies": { - "app-builder-bin": "1.6.0", + "app-builder-bin": "1.7.0", "temp-file": "^3.1.1", "fs-extra-p": "^4.5.2", "is-ci": "^1.1.0", @@ -24,7 +24,7 @@ "7zip-bin": "~3.1.0", "semver": "^5.5.0", "lazy-val": "^1.0.3", - "js-yaml": "^3.10.0" + "js-yaml": "^3.11.0" }, "typings": "./out/util.d.ts" } diff --git a/packages/builder-util/src/DebugLogger.ts b/packages/builder-util/src/DebugLogger.ts index 33f2ed0f9b0..74f2bcb64c4 100644 --- a/packages/builder-util/src/DebugLogger.ts +++ b/packages/builder-util/src/DebugLogger.ts @@ -1,4 +1,3 @@ -import BluebirdPromise from "bluebird-lst" import { outputFile } from "fs-extra-p" import { serializeToYaml } from "./util" @@ -46,7 +45,7 @@ export class DebugLogger { return outputFile(file, serializeToYaml(this.data)) } else { - return BluebirdPromise.resolve() + return Promise.resolve() } } } \ No newline at end of file diff --git a/packages/builder-util/src/asyncTaskManager.ts b/packages/builder-util/src/asyncTaskManager.ts index 754f7005a6b..b912c644424 100644 --- a/packages/builder-util/src/asyncTaskManager.ts +++ b/packages/builder-util/src/asyncTaskManager.ts @@ -29,7 +29,7 @@ export class AsyncTaskManager { .catch(it => { log.debug({error: it.message || it.toString()}, "async task error") this.errors.push(it) - return BluebirdPromise.resolve(null) + return Promise.resolve(null) })) } diff --git a/packages/dmg-builder/package.json b/packages/dmg-builder/package.json index 252f6634fb1..9ad7399b302 100644 --- a/packages/dmg-builder/package.json +++ b/packages/dmg-builder/package.json @@ -18,7 +18,7 @@ "parse-color": "^1.0.0", "builder-util": "^0.0.0-semantic-release", "iconv-lite": "^0.4.19", - "js-yaml": "^3.10.0", + "js-yaml": "^3.11.0", "electron-builder-lib": "~0.0.0-semantic-release", "sanitize-filename": "^1.6.1" }, diff --git a/packages/electron-builder-lib/package.json b/packages/electron-builder-lib/package.json index d85ab3abe49..2ba4b58a5ba 100644 --- a/packages/electron-builder-lib/package.json +++ b/packages/electron-builder-lib/package.json @@ -42,7 +42,7 @@ "homepage": "https://github.com/electron-userland/electron-builder", "dependencies": { "7zip-bin": "~3.1.0", - "app-builder-bin": "1.6.0", + "app-builder-bin": "1.7.0", "async-exit-hook": "^2.0.1", "bluebird-lst": "^1.0.5", "chromium-pickle-js": "^0.2.0", @@ -54,7 +54,7 @@ "hosted-git-info": "^2.5.0", "is-ci": "^1.1.0", "isbinaryfile": "^3.0.2", - "js-yaml": "^3.10.0", + "js-yaml": "^3.11.0", "read-config-file": "3.0.0", "minimatch": "^3.0.4", "normalize-package-data": "^2.4.0", diff --git a/packages/electron-builder-lib/src/fileMatcher.ts b/packages/electron-builder-lib/src/fileMatcher.ts index 01db0237101..1962dcc9994 100644 --- a/packages/electron-builder-lib/src/fileMatcher.ts +++ b/packages/electron-builder-lib/src/fileMatcher.ts @@ -229,7 +229,7 @@ export function getFileMatchers(config: Configuration, name: "files" | "extraFil /** @internal */ export function copyFiles(matchers: Array | null): Promise { if (matchers == null || matchers.length === 0) { - return BluebirdPromise.resolve() + return Promise.resolve() } return BluebirdPromise.map(matchers, async (matcher: FileMatcher) => { diff --git a/packages/electron-builder-lib/src/packager.ts b/packages/electron-builder-lib/src/packager.ts index 670ee4220ee..319b9549c30 100644 --- a/packages/electron-builder-lib/src/packager.ts +++ b/packages/electron-builder-lib/src/packager.ts @@ -497,7 +497,7 @@ function createOutDirIfNeed(targetList: Array, createdOutDirs: Set { if (this.buildStarted) { - return BluebirdPromise.resolve() + return Promise.resolve() } this.buildStarted = true diff --git a/packages/electron-builder-lib/src/targets/nsis/nsisUtil.ts b/packages/electron-builder-lib/src/targets/nsis/nsisUtil.ts index 98c6aec4409..9979d1eef65 100644 --- a/packages/electron-builder-lib/src/targets/nsis/nsisUtil.ts +++ b/packages/electron-builder-lib/src/targets/nsis/nsisUtil.ts @@ -70,7 +70,7 @@ export class CopyElevateHelper { } if (isPackElevateHelper === false) { - return BluebirdPromise.resolve() + return Promise.resolve() } let promise = this.copied.get(appOutDir) diff --git a/packages/electron-builder/src/cli/install-app-deps.ts b/packages/electron-builder/src/cli/install-app-deps.ts index 1c6e4a452ea..35e77687d27 100644 --- a/packages/electron-builder/src/cli/install-app-deps.ts +++ b/packages/electron-builder/src/cli/install-app-deps.ts @@ -50,7 +50,7 @@ export async function installAppDeps(args: any) { const muonVersion = config.muonVersion const results = await BluebirdPromise.all([ computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)), - muonVersion == null ? getElectronVersion(projectDir, config, packageMetadata) : BluebirdPromise.resolve(muonVersion), + muonVersion == null ? getElectronVersion(projectDir, config, packageMetadata) : Promise.resolve(muonVersion), ]) // if two package.json — force full install (user wants to install/update app deps in addition to dev) diff --git a/packages/electron-updater/package.json b/packages/electron-updater/package.json index 05c3daa4242..acecce4b155 100644 --- a/packages/electron-updater/package.json +++ b/packages/electron-updater/package.json @@ -15,7 +15,7 @@ "lazy-val": "^1.0.3", "bluebird-lst": "^1.0.5", "fs-extra-p": "^4.5.2", - "js-yaml": "^3.10.0", + "js-yaml": "^3.11.0", "semver": "^5.5.0", "source-map-support": "^0.5.3", "builder-util-runtime": "~0.0.0-semantic-release", diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index 390647fc096..83d2bcb12d5 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -1,4 +1,3 @@ -import BluebirdPromise from "bluebird-lst" import { AllPublishOptions, asArray, CancellationToken, newError, PublishConfiguration, UpdateInfo, UUID } from "builder-util-runtime" import { randomBytes } from "crypto" import { Notification } from "electron" @@ -226,7 +225,7 @@ export abstract class AppUpdater extends EventEmitter { checkForUpdatesAndNotify(): Promise { if (isDev) { - return BluebirdPromise.resolve(null) + return Promise.resolve(null) } this.signals.updateDownloaded(it => { diff --git a/packages/electron-updater/src/differentialDownloader/DataSplitter.ts b/packages/electron-updater/src/differentialDownloader/DataSplitter.ts index 91ea3106c16..fb88fbc67eb 100644 --- a/packages/electron-updater/src/differentialDownloader/DataSplitter.ts +++ b/packages/electron-updater/src/differentialDownloader/DataSplitter.ts @@ -1,4 +1,3 @@ -import BluebirdPromise from "bluebird-lst" import { newError } from "builder-util-runtime" import { createReadStream } from "fs-extra-p" import { Writable } from "stream" @@ -158,7 +157,7 @@ export class DataSplitter extends Writable { } private copyExistingData(index: number, end: number) { - return new BluebirdPromise((resolve, reject) => { + return new Promise((resolve, reject) => { const w = () => { if (index === end) { resolve() @@ -218,10 +217,10 @@ export class DataSplitter extends Writable { this.actualPartLength += end - start const out = this.out if (out.write(start === 0 && data.length === end ? data : data.slice(start, end))) { - return BluebirdPromise.resolve() + return Promise.resolve() } else { - return new BluebirdPromise((resolve, reject) => { + return new Promise((resolve, reject) => { out.on("error", reject) out.once("drain", () => { out.removeListener("error", reject) diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts index f4bea987339..99fe048171b 100644 --- a/test/src/BuildTest.ts +++ b/test/src/BuildTest.ts @@ -120,7 +120,7 @@ test.ifLinuxOrDevMac("afterPack", () => { config: { afterPack: () => { called++ - return BluebirdPromise.resolve() + return Promise.resolve() } } }, { @@ -137,7 +137,7 @@ test.ifLinuxOrDevMac("afterSign", () => { config: { afterSign: () => { called++ - return BluebirdPromise.resolve() + return Promise.resolve() } } }, { @@ -236,6 +236,6 @@ test.ifAll.ifDevOrLinuxCi("posix smart unpack", app({ packed: context => verifySmartUnpack(context.getResources(Platform.LINUX))})) test("wine version", async () => { - await checkWineVersion(BluebirdPromise.resolve("1.9.23 (Staging)")) - await checkWineVersion(BluebirdPromise.resolve("2.0-rc2")) + await checkWineVersion(Promise.resolve("1.9.23 (Staging)")) + await checkWineVersion(Promise.resolve("2.0-rc2")) }) diff --git a/test/src/helpers/downloadElectron.ts b/test/src/helpers/downloadElectron.ts index bbf86400d65..18090e32905 100644 --- a/test/src/helpers/downloadElectron.ts +++ b/test/src/helpers/downloadElectron.ts @@ -9,7 +9,7 @@ const downloadElectron: (options: any) => Promise = BluebirdPromise.promisi export function deleteOldElectronVersion(): Promise { // on CircleCi no need to clean manually if (process.env.CIRCLECI || !isCi) { - return BluebirdPromise.resolve() + return Promise.resolve() } const cacheDir = require("env-paths")("electron", {suffix: ""}).cache diff --git a/test/src/helpers/winHelper.ts b/test/src/helpers/winHelper.ts index 3017977f462..4cdd1be43a2 100644 --- a/test/src/helpers/winHelper.ts +++ b/test/src/helpers/winHelper.ts @@ -1,4 +1,3 @@ -import BluebirdPromise from "bluebird-lst" import { walk } from "builder-util/out/fs" import { Arch, Platform } from "electron-builder" import { readAsarJson } from "electron-builder-lib/out/asar/asar" @@ -31,7 +30,7 @@ export async function checkHelpers(resourceDir: string, packElevateHelper: boole export async function doTest(outDir: string, perUser: boolean, productFilename = "TestApp Setup", name = "TestApp", menuCategory: string | null = null, packElevateHelper = true) { if (process.env.DO_WINE !== "true") { - return BluebirdPromise.resolve() + return Promise.resolve() } const wine = new WineManager() diff --git a/test/src/mac/masTest.ts b/test/src/mac/masTest.ts index 18f7f65f969..be6468f7ea0 100644 --- a/test/src/mac/masTest.ts +++ b/test/src/mac/masTest.ts @@ -40,7 +40,7 @@ test.ifAll("custom mas", () => { entitlements: "mas-entitlements file path", "entitlements-inherit": "mas-entitlementsInherit file path", }) - return BluebirdPromise.resolve(null) + return Promise.resolve(null) } }) }) @@ -62,7 +62,7 @@ test.ifAll("entitlements in the package.json", () => { entitlements: "osx-entitlements file path", "entitlements-inherit": "osx-entitlementsInherit file path", }) - return BluebirdPromise.resolve() + return Promise.resolve() } }) }) @@ -82,7 +82,7 @@ test.ifAll("entitlements in build dir", () => { entitlements: path.join(context.projectDir, "build", "entitlements.mac.plist"), "entitlements-inherit": path.join(context.projectDir, "build", "entitlements.mac.inherit.plist"), }) - return BluebirdPromise.resolve() + return Promise.resolve() } }) }) diff --git a/yarn.lock b/yarn.lock index f9491998db4..25d3bd6ec41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -275,25 +275,25 @@ anymatch@^1.3.0: micromatch "^2.1.5" normalize-path "^2.0.0" -app-builder-bin-linux@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.6.0.tgz#d7731d7988b8a740e74d591cbd565f168a266111" +app-builder-bin-linux@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.7.0.tgz#83894c51e224382a7268997cc8af1283c1be21e3" -app-builder-bin-mac@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.6.0.tgz#c976da70796d67aeb7134a57899636f2581d1c67" +app-builder-bin-mac@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.7.0.tgz#067a91d612fd3c2b687a097343ec4bb5f42c2e5f" -app-builder-bin-win@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.6.0.tgz#528ef96430d519c270b4de260bea0ddc70df1733" +app-builder-bin-win@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.7.0.tgz#caf81af88c5506717e4015880981b4ed3508414f" -app-builder-bin@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.6.0.tgz#c0e88a488d4c23c2e7fe0bbfb70c1d61165be206" +app-builder-bin@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.7.0.tgz#cb83e469d511f3516af7bca5288b692604bbd5c1" optionalDependencies: - app-builder-bin-linux "1.6.0" - app-builder-bin-mac "1.6.0" - app-builder-bin-win "1.6.0" + app-builder-bin-linux "1.7.0" + app-builder-bin-mac "1.7.0" + app-builder-bin-win "1.7.0" append-transform@^0.4.0: version "0.4.0" @@ -3259,6 +3259,13 @@ js-yaml@^3.10.0, js-yaml@^3.4.2, js-yaml@^3.7.0, js-yaml@^3.9.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + js2xmlparser@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-3.0.0.tgz#3fb60eaa089c5440f9319f51760ccd07e2499733"