Browser App and Extension Boilerplate using Redux Actions
Simple boilerplate and library for building Electron and Chrome apps, and cross-browser extensions that use Redux actions for messaging.
Redux states are synced between background, inject page, app window, extension popup and badge.
The developing is the same as for the web apps with React and Redux, just use the src/app
boilerplate.
Structure
src/app
: React cross-browser application (will be imported in the apps bellow).src/web
: web app sources.src/browser
: extensions sources.src/chromeApp
: Chrome app sourcessrc/electron
: Electron app sourcestest/app
: tests for Redux actions and reducers, and for React components (using enzyme).test/chrome
: tests for Chrome app and extension (using chromedriver, selenium-webdriver).
Boilerplate specific dependencies
Installation
npm install
Development
npm run dev
React/Flux hot reload
This boilerplate uses Webpack
and react-transform
. You can hot reload by editing related files of ./src/app
. If the inject page for the extension is on https (like https://github.com
), click the 'shield' icon on the Chrome address bar to allow loading http://localhost
there (after making any changes in dev mode), so hot reload can work for that page.
Debug with Redux DevTools
We use Redux DevTools Extension, install it from Chrome store for debugging.
Build web app
npm run build:web
Build Electron app
npm run build:electron
npm run start:electron
Build Chrome app
npm run build:app
Build Chrome extension
npm run build:extension
Build Firefox extension
npm run build:firefox
Note that it's not possible for now to load Firefox extensions from local directories, so use npm run compress:firefox
instead to generate an xpi file.
Build & Compress
npm run compress:electron
npm run compress:app
npm run compress:extension
npm run compress:firefox
Load
Test
npm run test:app
npm run before:test:chrome
npm run test:chrome:extension
npm run test:chrome:app
npm run test:chrome
npm test
Roadmap
LICENSE
MIT