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

Adds non-fatal warnings to the build tools #1325

Merged
merged 7 commits into from
Feb 23, 2018
Merged

Adds non-fatal warnings to the build tools #1325

merged 7 commits into from
Feb 23, 2018

Conversation

jeffposnick
Copy link
Contributor

R: @addyosmani @gauntface

Fixes #1315, fixes #1176

This adds in support for non-fatal warnings in workbox-build, as well as reporting those errors back to the developers via workbox-cli an workbox-webpack-plugin.

Two classes of problems are treated as warnings now:

  • A file that exceeded maximumFileSizeToCacheInBytes
  • Something going wrong when processing a single glob pattern, like that pattern not matching anything.

@jeffposnick jeffposnick added the Breaking Change Denotes a "major" semver change. label Feb 20, 2018
@coveralls
Copy link

coveralls commented Feb 21, 2018

Coverage Status

Coverage decreased (-0.3%) to 88.353% when pulling 71695be on build-warnings into 505122f on v3.

Copy link

@gauntface gauntface left a comment

Choose a reason for hiding this comment

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

This is ok, but I'm pretty gutted that we aren't logging warnings when the user uses workbox-build.

I.e. if I use the CLI and webpack - I get warnings logged to the console but if I use Gulp, I have to wire this up :(

* };
*
* @callback ManifestTransform
* @param {Array<ManifestEntry>} manifestEntries The full array of entries,
* prior to the current transformation.
* @return {Array<ManifestEntry>} The array of entries with the transformation
* applied.
* @return {{manifest: Array<ManifestEntry>, warnings: Array<String>}}

Choose a reason for hiding this comment

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

Make the warnings optional to return.

});

return entry;
});
return {manifest, warnings: []};

Choose a reason for hiding this comment

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

Exclude the warnings here.

return entry;
});

return {manifest, warnings: []};

Choose a reason for hiding this comment

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

Exclude the warnings here.

@jeffposnick
Copy link
Contributor Author

jeffposnick commented Feb 22, 2018

I'm happy that we're returning the warnings in the API response for the gulp use case rather than trying to log anything meaningful ourselves.

E.g., we handle errors from modules in our own first-party gulp tasks by wrapping them in our own logging helper anyway. That's not uncommon, and I find it distracting when there are two copies of the same info logged.

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

File Before After Change GZipped
packages/workbox-cli/build/app.js 5.09 KB 6.50 KB +28% 2.16 KB ☠️
packages/workbox-webpack-plugin/build/generate-sw.js 7.21 KB 7.38 KB +2% 2.44 KB
packages/workbox-webpack-plugin/build/inject-manifest.js 8.82 KB 8.96 KB +2% 2.92 KB

New Files

No new files have been added.

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.52 KB 3.52 KB 0% 1.45 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.07 KB 1.07 KB 0% 573 B
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 2.52 KB 2.52 KB 0% 1.06 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.41 KB 3.41 KB 0% 1.26 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 594 B 594 B 0% 350 B
packages/workbox-cli/build/app.js 5.09 KB 6.50 KB +28% 2.16 KB ☠️
packages/workbox-cli/build/bin.js 2.32 KB 2.32 KB 0% 1.03 KB
packages/workbox-core/build/workbox-core.prod.js 6.48 KB 6.48 KB 0% 2.59 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.12 KB 2.12 KB 0% 1.05 KB
packages/workbox-precaching/build/workbox-precaching.prod.js 5.26 KB 5.26 KB 0% 2.06 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.64 KB 1.64 KB 0% 807 B
packages/workbox-routing/build/workbox-routing.prod.js 2.77 KB 2.77 KB 0% 1.25 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 3.26 KB 3.26 KB 0% 1.02 KB
packages/workbox-sw/build/workbox-sw.js 1.46 KB 1.46 KB 0% 793 B
packages/workbox-webpack-plugin/build/generate-sw.js 7.21 KB 7.38 KB +2% 2.44 KB
packages/workbox-webpack-plugin/build/index.js 742 B 742 B 0% 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 8.82 KB 8.96 KB +2% 2.92 KB

Workbox Aggregate Size Plugin

☠️ WARNING ☠️

We are using 155% of our max size budget.

Total Size: 22.7KB
Percentage of Size Used: 155%

Gzipped: 9.1KB

@jeffposnick jeffposnick merged commit b106450 into v3 Feb 23, 2018
@jeffposnick jeffposnick deleted the build-warnings branch February 23, 2018 00:38
@shakyShane
Copy link

@jeffposnick thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Denotes a "major" semver change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants