Skip to content

Commit

Permalink
fix(publish): resolve any publish configuration — not only string
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jan 17, 2017
1 parent ade922c commit 98c2c8e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/electron-builder/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class PublishManager {
}

const packager = event.packager
const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null))
const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, false))
if (publishConfigs == null || publishConfigs.length === 0) {
return
}
Expand All @@ -78,7 +78,7 @@ export class PublishManager {
private async artifactCreated(event: ArtifactCreated) {
const packager = event.packager
const target = event.target
const publishConfigs = event.publishConfig == null ? await getPublishConfigs(packager, target == null ? null : (<any>packager.config)[target.name]) : [event.publishConfig]
const publishConfigs = event.publishConfig == null ? await getPublishConfigs(packager, target == null ? null : (<any>packager.config)[target.name], !this.isPublishOptionGuessed) : [event.publishConfig]

if (publishConfigs == null) {
if (this.isPublish) {
Expand Down Expand Up @@ -170,7 +170,6 @@ async function getPublishConfigsForUpdateInfo(packager: PlatformPackager<any>, p
}
}
return publishConfigs

}

async function writeUpdateInfo(event: ArtifactCreated, _publishConfigs: Array<PublishConfiguration>) {
Expand Down Expand Up @@ -274,7 +273,7 @@ function computeDownloadUrl(publishConfig: PublishConfiguration, fileName: strin
}
}

export function getPublishConfigs(packager: PlatformPackager<any>, targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined): Promise<Array<PublishConfiguration>> | null {
export function getPublishConfigs(packager: PlatformPackager<any>, targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined, errorIfCannot: boolean): Promise<Array<PublishConfiguration>> | null {
let publishers

// check build.nsis (target)
Expand All @@ -296,7 +295,6 @@ export function getPublishConfigs(packager: PlatformPackager<any>, targetSpecifi

if (publishers == null) {
publishers = packager.config.publish
// triple equals - if explicitly set to null
if (publishers === null) {
return null
}
Expand All @@ -310,8 +308,7 @@ export function getPublishConfigs(packager: PlatformPackager<any>, targetSpecifi
}
}

//await getResolvedPublishConfig(packager.info, {provider: repositoryInfo.type}, false)
return BluebirdPromise.map(asArray(publishers), it => typeof it === "string" ? getResolvedPublishConfig(packager.info, {provider: <any>it}, true) : it)
return BluebirdPromise.map(asArray(publishers), it => getResolvedPublishConfig(packager.info, typeof it === "string" ? {provider: it} : it, errorIfCannot))
}

function sha256(file: string) {
Expand Down

0 comments on commit 98c2c8e

Please sign in to comment.