Skip to content

Conversation

@mwistrand
Copy link
Contributor

@mwistrand mwistrand commented Jun 5, 2018

Resolves most of #96 (adding the apple-touch-icon meta tag requires additional voodoo that may be better suited for webpack-contrib). Adds service worker support when using dist and dev modes. Relying on @dojo/webpack-contrib's service worker plugin, application developers can generate a fully-featured service worker via the .dojorc that supports pre-caching and custom route handling (and is automatically initialized when the app starts), or they can provide the path of an existing service worker file that will be copied to the output directory.

Tested locally on both Windows and macOS with a sandbox application, and verified on Windows with dojo eject.

mwistrand added 4 commits June 5, 2018 12:47
Allow service worker options to be specified in the dojorc. If the file
path for an existing service worker is provided, it is copied to the
output directory. Otherwise, a service worker file is generated that
contains a precache manifest, as well as any specified route handlers.

Further, when generating a service worker from the rc, an additional
entry point is added to the build that initializes the service worker at
startup.

Finally, iOS-specific meta tags related to PWAs are added to the
application's index.html (requires an upgraded to html-webpack-plugin).
- Update README
- Add missing util tests, as well as a functional test for the PWA meta
  tags
- Fix: use `cachePrefix` from dojorc over package.json `name`
@codecov
Copy link

codecov bot commented Jun 5, 2018

Codecov Report

Merging #101 into master will decrease coverage by 2.59%.
The diff coverage is 29.62%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #101     +/-   ##
=========================================
- Coverage   63.43%   60.83%   -2.6%     
=========================================
  Files           8        8             
  Lines         361      383     +22     
  Branches       67       79     +12     
=========================================
+ Hits          229      233      +4     
- Misses        127      145     +18     
  Partials        5        5
Impacted Files Coverage Δ
src/util/eject.ts 100% <ø> (ø)
src/main.ts 98.16% <100%> (ø) ⬆️
src/dist.config.ts 41.17% <25%> (-11%) ⬇️
src/dev.config.ts 27.77% <25%> (-4.23%) ⬇️
src/base.config.ts 26.59% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd99ac5...44dab3a. Read the comment docs.

src/sw-entry.ts Outdated
@@ -0,0 +1,5 @@
if ('serviceWorker' in navigator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file needed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not; it's in @dojo/webpack-contrib now. Good catch!

@mwistrand mwistrand merged commit 6f55f52 into dojo:master Jun 5, 2018
@dylans dylans added this to the 2018.06 milestone Jun 29, 2018
@mwistrand mwistrand deleted the 3-workbox branch August 13, 2018 16:43
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