Skip to content

A boilerplate to build offline-first web and desktop applications with React

Notifications You must be signed in to change notification settings

juliobetta/react-offline-hybrid-boilerplate

Repository files navigation

React Offline Hybrid Boilerplate

This boilerplate project is based on https://github.com/chentsulin/electron-react-boilerplate.

Hybrid (Electron + Browser [offline mode]) application boilerplate using:

Web Desktop
web desktop

Install

  • Note: requires a node version >= 6 and an npm version >= 3.

First, clone the repo via git:

git clone https://github.com/juliobetta/react-offline-hybrid-boilerplate.git your-project-name

And then install dependencies.

$ cd your-project-name && npm install

Run & Generate

Desktop in development mode

npm run dev-desktop

Web in development mode

npm run dev-web

... and access http://localhost:8080

Build Web package

npm run build-web

The files will be located in the folder build.

Generate Desktop package

OSX

npm run package

Linux

npm run package:linux

Windows

npm run package:win

All platforms at once

npm run package:all

The files will be located at release/[platform].

Before building for multiple platforms, please refer to https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build.

Tests

The project is covered by tests using Chai.

To run them once, execute:

npm run test:all

... or in watch mode:

npm run test:watch

You can run tests in isolation by using wildcards or even a path to a single file.

Wildcard

npm run test path/to/test/**/*.test.js

Single file

npm run test path/to/file.test.js

To run in watch mode, add -- --watch in front of the commands above.

Please, make sure to take a look at all available npm commands in package.json.

Editor Configuration

Atom

apm install editorconfig es6-javascript autocomplete-flow javascript-snippets linter linter-eslint language-babel

Sublime

Others

Troubleshooting

Tested on macOS

In case the terminal gets stuck on npm install, hit ctrl+C and run the following commands:

node_modules/.bin/electron-rebuild

...and then

bash postinstall.sh