Git Product home page Git Product logo

pwa's Introduction

Progressive Web App

A production grade progressive web app, to hit the ground running.

Setup

$ npm install

ENV Variables

  • NODE_ENV (build-dependent)

    • development: modules are bundled as is
    • production: modules are minified and uglified
  • PWA_ENV (build-dependent)

    • development: configs are obtained from /config/development.js
    • production: configs are obtained from /config/production.js
    • customPwaEnv: configs are obtained from /config/customPwaEnv.js
  • PWA_PUBLIC_PATH (build-dependent)

    • /build/client/: assets are fetched from the local filesystem
    • /production.cdn.com/build/client/: assets are fetched from this cdn path
    • /custom/path/: assets are fetched from /custom/path/
  • PWA_SSR (build-independent)

    • true: enable server side data fetching and rendering
    • false: disable server side data fetching and rendering
  • PORT (build-independent)

    • 8000: serve the app at port 8000
    • 1337: serve the app at port 1337

build-dependent: if any of these variables values have to be changed, assuming you change PWA_PUBLIC_PATH=//other.cdn.com in the staging:build script, then it requires a rebuild and a restart, npm run staging

build-independent: if any of these variable values have to be changed, assuming you change PWA_SSR=false in the staging:start script, then it only requires a restart, npm run staging:start

Usage

There are some useful npm scripts setup for you to start using these ENV variables effectively, please look at package.json to better understand how they're setup for each script.

Remember to run npm stop to stop all the pwa pm2 instances before using a different script from below.

Start as local development server with file watching:

$ npm start
# runs at http://localhost:8000
# npm run stop is automatically called for you after
# hitting ctrl+c to quit the webpack-dev-server

Start as local production server:

$ npm run development
# runs at http://localhost:1337

Start as staging server:

$ npm run staging
# runs at http://localhost:1337

Start as production server:

$ npm run production
# runs at http://localhost:1337

Using pm2:

$ npm run pm2 -- logs # follow all server logs
$ npm run pm2 -- list # list all processes
$ npm run pm2 -- kill # kill pm2 parent process
$ npm run pm2 -- help # show other available commands

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.