Minimal starter kit: โ๏ธโcreate-react-app
+ ๐ Lerna
+ Electron
# Fetch this repo
git clone https://github.com/amaurymartiny/cra-lerna-electron my-app
cd my-app
# Bootstrap the Lerna project, will install all modules
yarn install
The main idea of this starer kit is to separate the Electron and React parts.
.
โโโ lerna.json # Config for Lerna
โโโ package.json # Package.json for the whole repo
โโโ packages/
โ โโโ crale-electron/
โ โ โโโ electron-builder.json # Config for electron-build
โ โ โโโ electron-webpack.json # Config for electron-webpack
โ โ โโโ dist/ # Binaries bundles by electron-builder
โ โ โโโ package.json
โ โ โโโ src/
โ โ โ โโโ main/ # Your electron app goes here
โ โ โโโ static/ # Symlinks to ../crale-react/build/ folder
โ โโโ crale-react
โ โ โโโ build/ # The built app generated by CRA
โ โ โโโ package.json
โ โ โโโ src/ # Your react app goes here
All these commands should be run from the project root.
Command | Description |
---|---|
yarn start |
Run Electron and React in dev mode, with live reload on file changes. Allows fast iterations. |
yarn build |
Build Electron and React. |
yarn electron |
Build Electron and React, and open Electron with these built files. |
yarn package |
Build Electron and React, and generate binaries with these built files. |
yarn lint |
Check for linting issues in the code. |
yarn test |
Run tests. |
For the exhaustive list of available commands, check package.json
.
Tool | Description |
---|---|
create-react-app |
All tooling needed for React apps. |
lerna |
Manage JavaScript projects with multiple packages. |
electron-webpack |
Scripts and configurations to compile Electron applications using webpack. |
electron-builder |
A complete solution to package and build a ready for distribution Electron app. |
MIT.