Compress app bundle with Brotli
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
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
-
#5537
π (View in Graphite)
-
#5581
-
#5580
-
main
This stack of pull requests is managed by Graphite. Learn more about stacking.
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.
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.
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
mainyou might see odd diffs, rebasemaininto 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
/snapit
π«°β¨ 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
ETARGETerror, install it with NPM and the flag--@shopify:registry=https://registry.npmjs.org
[!CAUTION] After installing, validate the version by running just
shopifyin your terminal. If the versions don't match, you might have multiple global instances installed. Usewhich shopifyto find out which one you are running and uninstall it.