From 5d72c1040c9d4dacfe4bfc263c5c9addd1f20ff9 Mon Sep 17 00:00:00 2001 From: develar Date: Sun, 29 Jan 2017 11:27:25 +0100 Subject: [PATCH] fix: deepAssign error without config Close #1177 --- packages/electron-builder/src/cli/install-app-deps.ts | 2 +- packages/electron-builder/src/packager.ts | 3 ++- packages/electron-builder/src/util/readPackageJson.ts | 2 +- test/src/helpers/runTests.ts | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/electron-builder/src/cli/install-app-deps.ts b/packages/electron-builder/src/cli/install-app-deps.ts index 07cd9802981..0bbb2236a28 100644 --- a/packages/electron-builder/src/cli/install-app-deps.ts +++ b/packages/electron-builder/src/cli/install-app-deps.ts @@ -20,7 +20,7 @@ async function main() { .argv const projectDir = process.cwd() - const config = await loadConfig(projectDir) + const config = (await loadConfig(projectDir)) || {} const results: Array = await BluebirdPromise.all([ computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)), getElectronVersion(config, projectDir) diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts index cea6ee5d883..ff5feacbc58 100644 --- a/packages/electron-builder/src/packager.ts +++ b/packages/electron-builder/src/packager.ts @@ -93,7 +93,8 @@ export class Packager implements BuildInfo { configFromOptions = devMetadataFromOptions.build } - const config = deepAssign(await loadConfig(this.projectDir), configFromOptions) + const fileOrPackageConfig = await loadConfig(this.projectDir) + const config = fileOrPackageConfig == null ? configFromOptions : deepAssign(fileOrPackageConfig, configFromOptions) const extraMetadata = this.options.extraMetadata if (extraMetadata != null) { diff --git a/packages/electron-builder/src/util/readPackageJson.ts b/packages/electron-builder/src/util/readPackageJson.ts index 124cd876d59..2ab2f9f59ce 100644 --- a/packages/electron-builder/src/util/readPackageJson.ts +++ b/packages/electron-builder/src/util/readPackageJson.ts @@ -31,7 +31,7 @@ async function authors(file: string, data: any) { .map(it => it.replace(/^\s*#.*$/, "").trim()) } -export async function loadConfig(projectDir: string): Promise { +export async function loadConfig(projectDir: string): Promise { try { const configPath = path.join(projectDir, "electron-builder.yml") const result = safeLoad(await readFile(configPath, "utf8")) diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts index 8e950493a25..d88118affc9 100755 --- a/test/src/helpers/runTests.ts +++ b/test/src/helpers/runTests.ts @@ -125,6 +125,7 @@ async function runTests() { switch (scriptArg) { case "skipFpm": { testPathIgnorePatterns.push("[\\/]{1}fpmTest.js$") + testPathIgnorePatterns.push("[\\/]{1}linuxArchiveTest.js$") config.cacheDirectory += `-${suffix}` } break