Skip to content

Commit

Permalink
fix(packager): wait for artifactCreated completion event before start…
Browse files Browse the repository at this point in the history
…ing an upload (#6625)

When the configuration has an artifactBuildCompleted callback that is a Promise, the upload starts anyway as it listens to the artifactCreated event. This resolves that by first waiting for any hooks, then dispatching the event.
  • Loading branch information
DanielMcAssey committed Feb 10, 2022
1 parent 98c9850 commit c561af8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-starfishes-divide.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix(packager): wait for event before starting an upload
4 changes: 2 additions & 2 deletions packages/app-builder-lib/src/packager.ts
Expand Up @@ -271,12 +271,12 @@ export class Packager {
}

async callArtifactBuildCompleted(event: ArtifactCreated): Promise<void> {
this.dispatchArtifactCreated(event)

const handler = resolveFunction(this.config.artifactBuildCompleted, "artifactBuildCompleted")
if (handler != null) {
await Promise.resolve(handler(event))
}

this.dispatchArtifactCreated(event)
}

async callAppxManifestCreated(path: string): Promise<void> {
Expand Down

0 comments on commit c561af8

Please sign in to comment.