Skip to content

Commit

Permalink
fix: deepAssign error without config
Browse files Browse the repository at this point in the history
Close #1177
  • Loading branch information
develar committed Jan 29, 2017
1 parent 5d64693 commit 5d72c10
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/electron-builder/src/cli/install-app-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> = await BluebirdPromise.all([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
getElectronVersion(config, projectDir)
Expand Down
3 changes: 2 additions & 1 deletion packages/electron-builder/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/util/readPackageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function authors(file: string, data: any) {
.map(it => it.replace(/^\s*#.*$/, "").trim())
}

export async function loadConfig(projectDir: string): Promise<Config> {
export async function loadConfig(projectDir: string): Promise<Config | null> {
try {
const configPath = path.join(projectDir, "electron-builder.yml")
const result = safeLoad(await readFile(configPath, "utf8"))
Expand Down
1 change: 1 addition & 0 deletions test/src/helpers/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5d72c10

Please sign in to comment.