Skip to content

Commit

Permalink
fix(deployment): ensure that we await update meta files publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Oct 13, 2017
1 parent 67fe9ff commit b5d4d66
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion packages/electron-builder/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,20 @@ export class PublishManager implements PublishContext {
this.nameToPublisher.clear()
}

// noinspection InfiniteRecursionJS
async awaitTasks(): Promise<void> {
await this.taskManager.awaitTasks()
if (!this.cancellationToken.cancelled) {
if (this.postponedArtifactCreatedEvents.length === 0) {
return
}

const events = this.postponedArtifactCreatedEvents.slice()
this.postponedArtifactCreatedEvents.length = 0
for (const event of events) {
this.packager.dispatchArtifactCreated(event)
}
await this.taskManager.awaitTasks()
await this.awaitTasks()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/src/BaseS3Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export abstract class BaseS3Publisher extends Publisher {
})
}

return cancellationToken.createPromise((resolve, reject, onCancel) => {
return await cancellationToken.createPromise((resolve, reject, onCancel) => {
onCancel(() => uploader.abort())
uploader.upload()
.then(() => {
Expand Down
10 changes: 7 additions & 3 deletions test/src/helpers/fileAssert.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { exists, statOrNull } from "builder-util/out/fs"
import { lstat, stat } from "fs-extra-p"
import { lstat } from "fs-extra-p"
import * as path from "path"

// http://joel-costigliola.github.io/assertj/
Expand Down Expand Up @@ -39,9 +39,13 @@ class Assertions {
}

async isDirectory() {
const info = await stat(this.actual)
const file = this.actual
const info = await statOrNull(file)
if (info == null) {
throw new Error(`Path ${file} doesn't exist`)
}
if (!info.isDirectory()) {
throw new Error(`Path ${this.actual} is not a directory`)
throw new Error(`Path ${file} is not a directory`)
}
}

Expand Down

0 comments on commit b5d4d66

Please sign in to comment.