Skip to content

Commit 5d72c10

Browse files
committed
fix: deepAssign error without config
Close #1177
1 parent 5d64693 commit 5d72c10

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

packages/electron-builder/src/cli/install-app-deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function main() {
2020
.argv
2121

2222
const projectDir = process.cwd()
23-
const config = await loadConfig(projectDir)
23+
const config = (await loadConfig(projectDir)) || {}
2424
const results: Array<string> = await BluebirdPromise.all([
2525
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
2626
getElectronVersion(config, projectDir)

packages/electron-builder/src/packager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export class Packager implements BuildInfo {
9393
configFromOptions = devMetadataFromOptions.build
9494
}
9595

96-
const config = deepAssign(await loadConfig(this.projectDir), configFromOptions)
96+
const fileOrPackageConfig = await loadConfig(this.projectDir)
97+
const config = fileOrPackageConfig == null ? configFromOptions : deepAssign(fileOrPackageConfig, configFromOptions)
9798

9899
const extraMetadata = this.options.extraMetadata
99100
if (extraMetadata != null) {

packages/electron-builder/src/util/readPackageJson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function authors(file: string, data: any) {
3131
.map(it => it.replace(/^\s*#.*$/, "").trim())
3232
}
3333

34-
export async function loadConfig(projectDir: string): Promise<Config> {
34+
export async function loadConfig(projectDir: string): Promise<Config | null> {
3535
try {
3636
const configPath = path.join(projectDir, "electron-builder.yml")
3737
const result = safeLoad(await readFile(configPath, "utf8"))

test/src/helpers/runTests.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ async function runTests() {
125125
switch (scriptArg) {
126126
case "skipFpm": {
127127
testPathIgnorePatterns.push("[\\/]{1}fpmTest.js$")
128+
testPathIgnorePatterns.push("[\\/]{1}linuxArchiveTest.js$")
128129
config.cacheDirectory += `-${suffix}`
129130
}
130131
break

0 commit comments

Comments
 (0)