v3.x.x

Introduction

PWAinit is a command line tool for rapid PWA development. You can use it to create a new PWA project with boilerplate for manifest.json, sw.js & the index.html.

Using PWAinit you can also turn existing website to Progressive Web App by adding the PWA features. Currently PWAinit supports features like WebApp Manifest, Service Worker, PushAPI (frontend and backend)

Note: The documentations are written for v3.0.0+ and it is highly recommended to update your pwainit to latest version since some new features were added in this version ('npm update -g pwainit' to update the package).





Installation

Make sure you have NodeJS and NPM (usually comes with nodejs) installed in your system. You can check installation using 'node -v' and 'npm -v' commands.
Type following command in your terminal: npm install -g pwainit




Usage

Initiate Project

pwainit create <projectName>

Turn existing website to PWA

cd existingWebsite
pwainit add


Run PWA

Service Workers require https protocol or localhost to execute thus running index.html over file:// will not work. To serve files over localhost you can follow below commands. npm install -g serve
serve <projectDirectory>


If you've installed PushAPI with backend you will have to run the backend first. To do that, run: cd <projectDirectory>/pushapi-backend
node index.js





Configurations

Manifest

Does not require any additional configurations.



Service Worker

Does not require any additional configurations though you can add the paths of files you want to cache in variable urlsToCache[] in sw.js file.



PushAPI

If you have installed it with the backend code then it does not need any configurations just run the backend code and you're good to go.
If you have not installed backend then you will have to set your PushAPI backend public vapid key to the publicVapidKey variable in index.html.

Here's example to generate public vapid : github.com/saurabhdaware/pwainit-node-pushapi




Changelog

Checkout CHANGELOG.md for Release History




Contributing

Interested in working on this project? Fork and Checkout CONTRIBUTING.md for instructions to contribute




Articles


Wrote an article or created a video about PWAinit? List it here by editing Documenation Code


Thank you for checking out PWAinit! A for the repository would be highly appreciated 🚀!