cli icon indicating copy to clipboard operation
cli copied to clipboard

Compress app bundle with Brotli

Open gonzaloriestra opened this issue 11 months ago β€’ 5 comments

WHY are these changes introduced?

Related to https://github.com/Shopify/develop-app-outer-loop/issues/1412

Depends on https://github.com/shop/world/pull/18709

WHAT is this pull request doing?

Uses Brotli to compress the app bundle when using App Management API. It keeps using Zip for Partners.

How to test your changes?

With App Management:

  • SHOPIFY_CLI_NEVER_USE_PARTNERS_API=1 SHOPIFY_SERVICE_ENV=local p shopify app dev

With Partners:

  • p shopify app dev

Measuring impact

How do we know this change was effective? Please choose one:

  • [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • [ ] Existing analytics will cater for this addition
  • [ ] PR includes analytics changes to measure impact

Checklist

  • [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • [x] I've considered possible documentation changes

gonzaloriestra avatar Mar 18 '25 14:03 gonzaloriestra

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
76.9% (+0.12% πŸ”Ό)
9710/12626
🟑 Branches
72.23% (+0.13% πŸ”Ό)
4801/6647
🟑 Functions
76.7% (+0.04% πŸ”Ό)
2502/3262
🟑 Lines
77.43% (+0.13% πŸ”Ό)
9180/11856
Show files with reduced coverage πŸ”»
St.:grey_question:
File Statements Branches Functions Lines
🟒
... / archiver.ts
87.18% (-6.15% πŸ”»)
80% (-20% πŸ”»)
70% (-5% πŸ”»)
89.19% (-4.14% πŸ”»)

Test suite run success

2298 tests passing in 996 suites.

Report generated by πŸ§ͺjest coverage report action from e3652e5ebb0c21faa1a740e91d4a060e4686582a

github-actions[bot] avatar Mar 21 '25 11:03 github-actions[bot]

This stack of pull requests is managed by Graphite. Learn more about stacking.

gonzaloriestra avatar Mar 31 '25 10:03 gonzaloriestra

We detected some changes at packages/*/src and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

github-actions[bot] avatar Apr 22 '25 14:04 github-actions[bot]

We detected some changes at packages/*/src and there are no updates in the .changeset. If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

github-actions[bot] avatar May 06 '25 09:05 github-actions[bot]

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
@@ -20,4 +20,43 @@ interface ZipOptions {
  * @param options - ZipOptions.
  */
 export declare function zip(options: ZipOptions): Promise<void>;
+export interface BrotliOptions {
+    /**
+     * The directory to compress.
+     */
+    inputDirectory: string;
+    /**
+     * The path where the compressed file will be saved.
+     */
+    outputPath: string;
+    /**
+     * An optional glob pattern to match files.
+     */
+    matchFilePattern?: string | string[];
+    /**
+     * Brotli compression level (0-11, default: 11).
+     */
+    level?: number;
+}
+/**
+ * Options for decompressing a Brotli compressed tar archive.
+ */
+export interface DecompressionOptions {
+    /**
+     * Path to the compressed file.
+     */
+    inputFile: string;
+    /**
+     * Directory where files should be extracted.
+     */
+    outputDirectory: string;
+}
+/**
+ * It compresses a directory with Brotli.
+ * First creates a tar archive to preserve directory structure,
+ * then compresses it with Brotli.
+ *
+ * @param options - BrotliOptions.
+ */
+export declare function brotliCompress(options: BrotliOptions): Promise<void>;
 export {};
\ No newline at end of file

github-actions[bot] avatar May 15 '25 07:05 github-actions[bot]

/snapit

gonzaloriestra avatar May 15 '25 09:05 gonzaloriestra

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

[!TIP] If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

[!CAUTION] After installing, validate the version by running just shopify in your terminal. If the versions don't match, you might have multiple global instances installed. Use which shopify to find out which one you are running and uninstall it.

github-actions[bot] avatar May 15 '25 09:05 github-actions[bot]