Skip to content

RRoodselaar/PWA-boilerplate

Repository files navigation

PWA-boilerplate Build status Lighthouse badge Netlify Status

Based on Jad Joubran's repo pwa-series videos (https://github.com/jadjoubran/pwa-series).

The basic idea behind this repo is, that any feature to the repository and the resulting PWA can be studied by looking at the specific commit(s). Thus providing a running course in setting up your PWA and the automation from the committed code.

How to try out the code on your own machine

Prerequisites:

  1. Clone this repo.
  2. Run npm install.
  3. Start a local server with npx serve or use npm run dev for hot reload.
  4. Customize the source files in folder "src".
  5. Add your own splash icons by providing an image on https://realfavicongenerator.net.

Live demos

A demo site of the latest version of this project is hosted on both Netlify at https://pwa-boilerplates.netlify.app/ and GitHub Pages at https://rroodselaar.github.io/PWA-boilerplate/.

Netlify

The folks at Netlify supply various ways to automatically deploy using Git Integration and a neat CLI global tool.

GitHub Pages

This repo now employs a scripted push of the build-artifacts to a specific branch used to publish to GitHub Pages from. Automated with Git Hooks. Read more on this in:

To use the Git Hook-strategy with this repo, simply

  • apply execution rights to the Git hook file chmod +x .githooks/<hook filename> and
  • run git config core.hooksPath .githooks from the console in the root of your local copy.

Lighthouse integration

The Lighthouse Badge above is generated using Emanuele Mazzotta's Lighthouse Badges repo: https://github.com/emazzotta/lighthouse-badges.

These badges are automatically generated when committing into the master branch of this repository. This is done using the above mentioned Git Hook modification in conjunction with the Netlify CLI to run in a temporary deployment of the application on Netlify to enjoy all the benefits of TLS and other prerequisites for successful hosting of a PWA.

  1. install Lighthouse Badges from NPM npm i -g lighthouse-badges
  2. install the global tool npm install netlify-cli -g
  3. run netlify deploy --open once to link it to your account and see its behavior
  4. install JSON toolkit globally to parse output npm install -g json-cli-toolkit