Page MenuHomePhabricator

Prototype localizing the wikipedia portal in an offline-enabled serviceworker
Closed, DeclinedPublic

Description

In today's discovery portal sync-up meeting we set out a rough plan for offline-enabling the Wikipedia portal using a ServiceWorker, and the node-serviceworker-proxy infrastructure. See the meeting notes for detail of the discussion.

This task will track the concrete prototyping work.

  • @Krinkle has published the first steps towards setting up a serviceworker & integrating it in the gulp build process in https://gerrit.wikimedia.org/r/#/c/320244/.
  • Gabriel will build on this by
    • hooking up the serviceworker with node-serviceworker-proxy (in labs for now), and
    • starting to move the localization logic from DOM to the ServiceWorker, roughly as outlined in the meeting notes.

The result of this should be:

  • First view and clients without ServiceWorker support will see a fully localized copy of the portal, composed by node-serviceworker-proxy running the serviceworker code. Caching will vary on accept-language.
  • Subsequent views in modern clients (mainly Chrome, possibly Firefox) will use the installed local ServiceWorker to serve the portal. This will be very quick, and will also render the portal when offline.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
GWicke triaged this task as Medium priority.Nov 7 2016, 10:01 PM

I started looking into integrating a webpack based build for the serviceworker, similar to https://github.com/gwicke/streaming-serviceworker-playground. Current notes:

  • Integrate webpack with https://www.npmjs.com/package/gulp-webpack
  • Set up a separate index.handlebars build without client-side localization code (handled in serviceworker).
    • Can we still use the same template for both? Would be nice to avoid template duplication.

A WIP patch adding a webpack serviceworker build & a rough separated build grunt pipeline is now available in https://gerrit.wikimedia.org/r/#/c/321565/.

Next steps:

  • Replicate top10 / localization functionality in ServiceWorker. I think it's possible to avoid forking the template.
  • Clean up build process. The duplication of rules is quite ugly.

This isn't going to happen any more.