Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorize Deployed Bundle Size #3928

Merged
merged 3 commits into from
Sep 15, 2023
Merged

Conversation

JacobMGEvans
Copy link
Contributor

@JacobMGEvans JacobMGEvans commented Sep 11, 2023

Most bundlers, and other tooling that give you size outputs will colorize their the text to indicate if the value is within certain ranges.

Screenshot 2023-09-12 at 10 03 17 AM

Fixes #1312

Most bundlers, and other tooling that give you size outputs will colorize their the text to indicate if the value is within certain ranges.
@JacobMGEvans JacobMGEvans requested a review from a team as a code owner September 11, 2023 21:38
@changeset-bot
Copy link

changeset-bot bot commented Sep 11, 2023

🦋 Changeset detected

Latest commit: db58d6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #3928 (db58d6e) into main (a986f19) will increase coverage by 0.02%.
Report is 20 commits behind head on main.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3928      +/-   ##
==========================================
+ Coverage   75.10%   75.13%   +0.02%     
==========================================
  Files         195      195              
  Lines       11487    11533      +46     
  Branches     3036     3054      +18     
==========================================
+ Hits         8627     8665      +38     
- Misses       2860     2868       +8     
Files Changed Coverage Δ
.../wrangler/src/deployment-bundle/bundle-reporter.ts 97.36% <90.00%> (-2.64%) ⬇️
packages/wrangler/src/user/user.ts 72.23% <100.00%> (ø)

... and 10 files with indirect coverage changes

@@ -29,7 +30,16 @@ export async function printBundleSize(
gzipSize / ONE_KIB_BYTES
).toFixed(2)} KiB`;

logger.log(`Total Upload: ${bundleReport}`);
const percentage = (gzipSize / ONE_MIB_BYTES) * 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh dang! I can change that for this PR

Copy link
Contributor

@Skye-31 Skye-31 Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoyingly it's different for free/paid accounts, and there's not any easy way to tell which limit we should show

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh gawd...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be safer to keep it at 1Mib? Any size over that will become purged from edge colos a lot more quickly when it's not been recently requested, in comparison to smaller scripts, so it's definitely the maximum script size to aim for

Copy link
Contributor

@mrbbot mrbbot Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the deploy API report the maximum allowed worker size in a response header? Presumably it has access to it so it can restrict uploads. We could then use that for future upload requests in the session, or wait until after the request completed to log the request size?

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-wrangler-3928

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6200946190/npm-package-wrangler-3928

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-wrangler-3928 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-cloudflare-pages-shared-3928

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.8.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare 3.20230904.0 3.20230904.0
workerd 1.20230904.0 1.20230904.0
workerd --version 1.20230904.0 2023-09-04

|

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@JacobMGEvans JacobMGEvans merged commit 95b24b1 into main Sep 15, 2023
@JacobMGEvans JacobMGEvans deleted the jacobmgevans/colorized-size-output branch September 15, 2023 17:28
@github-actions github-actions bot mentioned this pull request Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

polish: [bundle reporter] color ranged size
4 participants