Skip to content

Commit b5d4d66

Browse files
committed
fix(deployment): ensure that we await update meta files publishing
1 parent 67fe9ff commit b5d4d66

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

packages/electron-builder/src/publish/PublishManager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,20 @@ export class PublishManager implements PublishContext {
157157
this.nameToPublisher.clear()
158158
}
159159

160+
// noinspection InfiniteRecursionJS
160161
async awaitTasks(): Promise<void> {
161162
await this.taskManager.awaitTasks()
162163
if (!this.cancellationToken.cancelled) {
164+
if (this.postponedArtifactCreatedEvents.length === 0) {
165+
return
166+
}
167+
163168
const events = this.postponedArtifactCreatedEvents.slice()
164169
this.postponedArtifactCreatedEvents.length = 0
165170
for (const event of events) {
166171
this.packager.dispatchArtifactCreated(event)
167172
}
168-
await this.taskManager.awaitTasks()
173+
await this.awaitTasks()
169174
}
170175
}
171176
}

packages/electron-publisher-s3/src/BaseS3Publisher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export abstract class BaseS3Publisher extends Publisher {
5959
})
6060
}
6161

62-
return cancellationToken.createPromise((resolve, reject, onCancel) => {
62+
return await cancellationToken.createPromise((resolve, reject, onCancel) => {
6363
onCancel(() => uploader.abort())
6464
uploader.upload()
6565
.then(() => {

test/src/helpers/fileAssert.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { exists, statOrNull } from "builder-util/out/fs"
2-
import { lstat, stat } from "fs-extra-p"
2+
import { lstat } from "fs-extra-p"
33
import * as path from "path"
44

55
// http://joel-costigliola.github.io/assertj/
@@ -39,9 +39,13 @@ class Assertions {
3939
}
4040

4141
async isDirectory() {
42-
const info = await stat(this.actual)
42+
const file = this.actual
43+
const info = await statOrNull(file)
44+
if (info == null) {
45+
throw new Error(`Path ${file} doesn't exist`)
46+
}
4347
if (!info.isDirectory()) {
44-
throw new Error(`Path ${this.actual} is not a directory`)
48+
throw new Error(`Path ${file} is not a directory`)
4549
}
4650
}
4751

0 commit comments

Comments
 (0)