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

CLI support for --watch #1776

Merged
merged 1 commit into from
Dec 12, 2018
Merged

CLI support for --watch #1776

merged 1 commit into from
Dec 12, 2018

Conversation

jeffposnick
Copy link
Contributor

Prior to filing a PR, please:

  • open an issue to discuss your proposed change.
  • ensure that gulp lint test passes locally.

R: @philipwalton

Fixes #1490

Adds support for a --watch flag that can be passed to the CLI's injectManifest and generateSW modes. If provided, the CLI will stay running and will rebuild the SW whenever one of the globPatterns matches changes.

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.60 KB +3% 1.56 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 1.88 KB +68% 939 B ☠️
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.88 KB 3.15 KB -19% 1.29 KB 🎉
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 594 B +1% 350 B
packages/workbox-cli/build/app.js 6.76 KB 5.58 KB -17% 1.98 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 6.09 KB -18% 2.75 KB 🎉
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 660 B 667 B +1% 323 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.80 KB 5.27 KB -9% 2.21 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.53 KB -6% 764 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.28 KB +14% 1.43 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.75 KB -7% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.39 KB -12% 683 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.51 KB +1% 818 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 6.91 KB -33% 2.40 KB 🎉

New Files

File Size GZipped
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.74 KB 877 B

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.60 KB +3% 1.56 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 1.88 KB +68% 939 B ☠️
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.88 KB 3.15 KB -19% 1.29 KB 🎉
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 594 B +1% 350 B
packages/workbox-cli/build/app.js 6.76 KB 5.58 KB -17% 1.98 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 6.09 KB -18% 2.75 KB 🎉
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.74 KB 877 B
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 660 B 667 B +1% 323 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.80 KB 5.27 KB -9% 2.21 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.53 KB -6% 764 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.28 KB +14% 1.43 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.75 KB -7% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.39 KB -12% 683 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.51 KB +1% 818 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 6.91 KB -33% 2.40 KB 🎉

Workbox Aggregate Size Plugin

9.81KB gzip'ed (65% of limit)
24.06KB uncompressed

Copy link
Member

@philipwalton philipwalton left a comment

Choose a reason for hiding this comment

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

LGTM with one optional suggestion.

logger.warn(warning);
}

logger.log(`The service worker was written to ${config.swDest}\n` +
Copy link
Member

Choose a reason for hiding this comment

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

I'm totally fine if we don't do this, but it might be nice have a slightly different log message in the case of a rebuild do to a watched file changing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's an additional log message at L39 which I think takes care of calling out that distinction.

@jeffposnick jeffposnick merged commit 1ceaa28 into next Dec 12, 2018
@philipwalton philipwalton deleted the cli-watch branch February 22, 2019 22:17
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.

3 participants