Note: Setup directions based on the Medium post from Kitze
Create react application:
npx create-react-app ghost
Add electron:
yarn add --dev concurrently electron electron-builder wait-on
yarn add electron-is-dev
Copy electron.js
to public/electron.js
.
Update entry point in package.json
:
"main": "public/electron.js"
Add script to package.json
:
"electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on https://localhost:3000 && electron .\""
Verify development version runs:
$ yarn electron-dev
Update package.json
:
"build": {
"appId": "com.ghost.electron",
"files": [
"build/**/*",
"node_modules/**/*"
],
"directories":{
"buildResources": "assets"
}
}
Add scripts to package.json
:
"electron-pack": "build -c.extraMetadata.main=build/electron.js",
"preelectron-pack": "yarn build"
Add homepage to package.json
:
"homepage": "./"
Build the production version:
$ yarn electron-pack
Once complete, the prebuilt application files are located in dist
directory.
Add StandardJS linting rules:
yarn add standard
Update package.json
with new section:
"standard": {
"parser": "babel-eslint",
"ignore": [
"config",
"scripts",
"src/app/registerServiceWorker.js",
"src/**/*.test.js"
]
}
Add scripts to package.json
:
"fix": ". ./.env && yarn standard --fix",
"lint": ". ./.env && yarn standard"