Skip to content

[Refactor] Modernize archiver utilities with async/await#7993

Draft
gonzaloriestra wants to merge 1 commit into
mainfrom
refactor-archiver-async-await-2020363541973881611
Draft

[Refactor] Modernize archiver utilities with async/await#7993
gonzaloriestra wants to merge 1 commit into
mainfrom
refactor-archiver-async-await-2020363541973881611

Conversation

@gonzaloriestra

Copy link
Copy Markdown
Contributor

This PR refactors the archiving utilities in @shopify/cli-kit to follow modern asynchronous patterns.

Why:

The previous implementation used manual Promise wrappers and .then() chains which were more verbose and harder to reason about. Moving to async/await makes the control flow clearer, especially when coordinating multiple asynchronous operations like globbing, file reading, and stream finalization.

Changes:

  • zip: Now uses async/await for globbing and file addition. It waits for archive.finalize() and the output stream's close event before resolving.
  • brotliCompress: Similarly modernized to use async/await for the internal tar archive creation step.
  • Documentation: Added @returns to zip JSDoc.

How to test your changes?

CI. (Integration tests in packages/cli-kit/src/public/node/archiver.integration.test.ts cover these changes).


PR created automatically by Jules for task 2020363541973881611 started by @gonzaloriestra

Refactored `zip` and `brotliCompress` in `packages/cli-kit` to use `async/await` syntax instead of manual `Promise` constructor wrappers and `.then()`/`.catch()` chains. This improves readability and maintainability while preserving the existing behavior of awaiting both the archive finalization and the output stream closure.

- Replaced `.then()` chains with `await` in `zip` and `brotliCompress`.
- Used a dedicated promise to bridge stream 'close'/'error' events with the async flow.
- Added missing `@returns` JSDoc to `zip` to satisfy linting rules.
- Removed unnecessary `eslint-disable` comments for floating promises.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/archiver.d.ts
@@ -18,6 +18,7 @@ interface ZipOptions {
  * Windows.
  *
  * @param options - ZipOptions.
+ * @returns A promise that resolves when the directory has been zipped.
  */
 export declare function zip(options: ZipOptions): Promise<void>;
 export interface BrotliOptions {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant