├── .nvmrc
├── static
├── .nojekyll
├── js
│ └── ads.js
├── CNAME
├── logo
│ ├── logo.png
│ └── logo.svg
├── img
│ ├── app-showcase
│ │ ├── cmde.png
│ │ ├── dbglass.jpg
│ │ ├── falcon.png
│ │ ├── ivideo.png
│ │ ├── popsql.gif
│ │ ├── channels.jpg
│ │ ├── left-on-read.gif
│ │ ├── recollector.png
│ │ ├── popcorn-time-desktop.png
│ │ └── expresslrs-configurator.jpg
│ └── bundle-analyzer-example.png
└── css
│ └── custom.css
├── .husky
├── .gitignore
└── pre-commit
├── docs
├── reading-files.md
├── faq.md
├── internals.md
├── installation-debugging-solutions.md
├── building.md
├── installation.md
├── packaging.md
├── dev-tools.md
├── tool-tips.md
├── editor-configuration.md
├── adding-dependencies.md
├── e2e-tests.md
├── adding-assets.md
├── upgrade-guide.md
├── roadmap.md
├── electron-store.md
├── auto-update.md
├── component-tests.md
├── native-modules.md
├── integration-tests.md
├── app-showcase.md
├── ci.md
└── styling.md
├── .github
├── FUNDING.yml
└── workflows
│ ├── test.yml
│ └── codeql-analysis.yml
├── blog
└── 2018-10-22-hello-world.md
├── .editorconfig
├── sidebars.js
├── src
├── css
│ └── custom.css
└── pages
│ ├── styles.module.css
│ └── index.js
├── README.md
├── .eslintignore
├── .gitignore
├── LICENSE
├── crowdin.yaml
├── package.json
├── .proselintrc
└── docusaurus.config.js
/.nvmrc:
--------------------------------------------------------------------------------
1 | node
--------------------------------------------------------------------------------
/static/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/static/js/ads.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.husky/.gitignore:
--------------------------------------------------------------------------------
1 | _
2 |
--------------------------------------------------------------------------------
/static/CNAME:
--------------------------------------------------------------------------------
1 | electron-react-boilerplate.js.org
2 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
4 | npx lint-staged
5 |
--------------------------------------------------------------------------------
/static/logo/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/logo/logo.png
--------------------------------------------------------------------------------
/docs/reading-files.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: reading-files
3 | title: Reading Files
4 | sidebar_label: Reading Files
5 | ---
6 |
--------------------------------------------------------------------------------
/static/img/app-showcase/cmde.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/cmde.png
--------------------------------------------------------------------------------
/static/img/app-showcase/dbglass.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/dbglass.jpg
--------------------------------------------------------------------------------
/static/img/app-showcase/falcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/falcon.png
--------------------------------------------------------------------------------
/static/img/app-showcase/ivideo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/ivideo.png
--------------------------------------------------------------------------------
/static/img/app-showcase/popsql.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/popsql.gif
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [amilajack]
2 | patreon: amilajack
3 | custom: ['https://paypal.me/amilajack', 'https://venmo.com/amilajack']
4 |
--------------------------------------------------------------------------------
/static/img/app-showcase/channels.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/channels.jpg
--------------------------------------------------------------------------------
/static/img/bundle-analyzer-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/bundle-analyzer-example.png
--------------------------------------------------------------------------------
/static/img/app-showcase/left-on-read.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/left-on-read.gif
--------------------------------------------------------------------------------
/static/img/app-showcase/recollector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/recollector.png
--------------------------------------------------------------------------------
/static/img/app-showcase/popcorn-time-desktop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/popcorn-time-desktop.png
--------------------------------------------------------------------------------
/static/img/app-showcase/expresslrs-configurator.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/electron-react-boilerplate/docs/HEAD/static/img/app-showcase/expresslrs-configurator.jpg
--------------------------------------------------------------------------------
/blog/2018-10-22-hello-world.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Hello World
3 | author: Amila Welihinda
4 | ---
5 |
6 | After a couple years of development, electron-react-boilerplate finally has a website! Subscribe to our blog for updates on the progress of the project
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/static/css/custom.css:
--------------------------------------------------------------------------------
1 | /* your custom css */
2 |
3 | @media only screen and (min-device-width: 360px) and (max-device-width: 736px) {
4 | }
5 |
6 | @media only screen and (min-width: 1024px) {
7 | }
8 |
9 | @media only screen and (max-width: 1023px) {
10 | }
11 |
12 | @media only screen and (min-width: 1400px) {
13 | }
14 |
15 | @media only screen and (min-width: 1500px) {
16 | }
17 |
--------------------------------------------------------------------------------
/sidebars.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | docs: {
3 | "Getting Started": ["installation", "editor-configuration"],
4 | Basics: [
5 | "building",
6 | "packaging",
7 | "adding-assets",
8 | "adding-dependencies",
9 | "native-modules",
10 | "styling",
11 | "auto-update",
12 | ],
13 | Testing: ["component-tests", "integration-tests", "ci"],
14 | Advanced: ["electron-store", "internals", "tool-tips", "dev-tools", "faq"],
15 | Guides: ["upgrade-guide"],
16 | "Community Content": ["app-showcase"],
17 | },
18 | };
19 |
--------------------------------------------------------------------------------
/docs/faq.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: faq
3 | title: FAQ
4 | sidebar_label: FAQ
5 | ---
6 |
7 | ## Why is webpack a good idea for electron?
8 |
9 | Electron apps face huge hurdles when it comes to matching native performance. There's a number of reasons for that. One of those issues is that a main electron app does not have Ahead-of-Time (AOT) compilation. No optimizations are made to code performance. [`require()`](https://kev.inburke.com/kevin/node-require-is-dog-slow/) is **really** slow. Webpack helps us reduce the amount of calls made to require by bundling all our code (when possible) into single file. [Atom is slow primarily because it makes so many require statements](https://github.com/atom/atom/issues/9720).
10 |
--------------------------------------------------------------------------------
/docs/internals.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: internals
3 | title: Internals
4 | sidebar_label: Internals
5 | ---
6 |
7 | ## Webpack Configurations
8 |
9 | Webpack configs are located inside the `./configs` directory
10 |
11 | ## Internal Scripts
12 |
13 | The scripts inside the `.erb/scripts` handle functionality that cannot be written as npm scripts.
14 |
15 | The scripts are the following:
16 |
17 | - `check-build-exists.js`: Check if the main and renderer processes have been built. These processes must be build before running E2E tests
18 | - `check-node-env.js`: Assert that `NODE_ENV` is the expected value. Throw if assertion fails
19 | - `check-port-in-use.js`: Finds a free port if default port for ERB is in use
20 |
--------------------------------------------------------------------------------
/src/css/custom.css:
--------------------------------------------------------------------------------
1 | /**
2 | * /src/css/custom.css
3 | * You can override the default Infima variables here.
4 | * Note: this is not a complete list of --ifm- variables.
5 | */
6 | :root {
7 | --ifm-color-primary: #b54692;
8 | --ifm-color-primary-dark: #a33f83;
9 | --ifm-color-primary-darker: #9a3b7c;
10 | --ifm-color-primary-darkest: #60254d;
11 | --ifm-color-primary-light: #be569d;
12 | --ifm-color-primary-lighter: #c15fa2;
13 | --ifm-color-primary-lightest: #cc7bb2;
14 | }
15 |
16 | .announcementBarContent_node_modules-\@docusaurus-theme-classic-lib-theme-AnnouncementBar-styles-module {
17 | background-color: var(--ifm-color-primary);
18 | color: white;
19 | padding: 2rem;
20 | font-weight: bold;
21 | text-decoration: none;
22 | }
23 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: Test
2 |
3 | on: push
4 |
5 | jobs:
6 | release:
7 | runs-on: ${{ matrix.os }}
8 |
9 | strategy:
10 | matrix:
11 | os: [ubuntu-latest]
12 |
13 | steps:
14 | - name: Check out Git repository
15 | uses: actions/checkout@v2
16 |
17 | - name: Install Node.js, NPM and npm
18 | uses: actions/setup-node@v2
19 | with:
20 | node-version: 16
21 | cache: npm
22 |
23 | - name: Install proselint
24 | run: |
25 | sudo add-apt-repository universe
26 | sudo apt-get install -y python3-proselint
27 |
28 | - name: npm ci
29 | run: npm ci
30 |
31 | - name: npm run build
32 | run: npm run build
33 |
34 | - name: npm test
35 | run: npm test
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # site
2 |
3 | [](https://github.com/electron-react-boilerplate/site/actions/workflows/test.yml)
4 |
5 | The website for [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate)
6 |
7 | ## Setup
8 |
9 | ```sh
10 | # Install dependencies
11 | npm install
12 | # Start the site
13 | npm start
14 | ```
15 |
16 | ## Project Stucture and Contributing
17 |
18 | For details, see [the docusarus docs](https://v2.docusaurus.io)
19 |
20 | ## Contributing
21 |
22 | ### Adding to App Showcase
23 |
24 | If you built an app with ERB and would like to add your app to the showcase, please add it to the end of the list.
25 |
26 | Please be sure to also include a screenshot or a .gif.
27 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17 | .grunt
18 |
19 | # node-waf configuration
20 | .lock-wscript
21 |
22 | # Compiled binary addons (http://nodejs.org/api/addons.html)
23 | build/Release
24 | .eslintcache
25 |
26 | # Dependency directory
27 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
28 | node_modules
29 |
30 | # OSX
31 | .DS_Store
32 |
33 | .idea
34 | npm-debug.log.*
35 | __snapshots__
36 |
37 | # Package.json
38 | package.json
39 | .travis.yml
40 | dist
41 | build
42 | static
43 |
44 | .docusaurus/site-gh-pages
45 |
--------------------------------------------------------------------------------
/docs/installation-debugging-solutions.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: installation-debugging-solutions
3 | title: Installation Debugging Solutions
4 | sidebar_label: Installation Debugging Solutions
5 | ---
6 |
7 | This to be a list of solutions for installation issues with this project:
8 |
9 | 1. Fix `node-gyp` issues:
10 | Follow the steps in [https://github.com/nodejs/node-gyp#installation](https://github.com/nodejs/node-gyp#installation). You don't need to install `node-gyp` but make sure that you have the correct environment setup for your OS.
11 | 2. Test installation against latest npm npm/node version
12 | 3. Fix Caching Issues
13 |
14 | ```
15 | rm -rf node_modules &&
16 | npm install &&
17 | npm run electron-rebuild &&
18 | npm start
19 | ```
20 |
21 | 4. If you're on Windows, try using [cmder](http://cmder.net)
22 |
23 | ### Debugging Release Builds
24 |
25 | ```bash
26 | cross-env DEBUG_PROD=true npm run build
27 | cross-env DEBUG_PROD=true npm start
28 | ```
29 |
--------------------------------------------------------------------------------
/docs/building.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: building
3 | title: Building
4 | sidebar_label: Building
5 | ---
6 |
7 | Webpack is one of the most crucial parts of ERB's infrastructure as with many other React projects. It provides us with many optimizations such as dead code stripping, tree shaking, and code splitting to name a few. Webpack allows you to scale your application and add many components and layers of abstraction without sacrificing the performance of your app.
8 |
9 | ## Build an App
10 |
11 | Building a production version of your app will optimize the JS, CSS, and SASS of your application.
12 |
13 | To create a production build, run `npm run build`:
14 |
15 | ```bash
16 | npm run build
17 | ```
18 |
19 | ## Inspecting Build Size
20 |
21 | If you want to reduce the build size of your app, you can open a treemap of your build:
22 |
23 | 
24 |
25 | To create a production build:
26 |
27 | ```bash
28 | ANALYZE=true npm run build
29 | ```
30 |
--------------------------------------------------------------------------------
/docs/installation.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: installation
3 | title: Installation
4 | sidebar_label: Installation
5 | ---
6 |
7 | ```bash
8 | # Clone the boilerplate:
9 | git clone --depth=1 \
10 | https://github.com/electron-react-boilerplate/electron-react-boilerplate \
11 | your-project-name
12 |
13 | cd your-project-name
14 |
15 | # Install dependencies:
16 | npm install
17 | ```
18 |
19 | :::tip
20 | If you have installation or compilation issues with this project, please see [our installation debugging guide](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/400)
21 | :::
22 |
23 | ## Run
24 |
25 | Start the app in the `dev` environment. This starts the main process with hot updates using [**electronmon**](https://github.com/catdad/electronmon) and the renderer process in [**hot-module-replacement**](https://webpack.js.org/guides/hot-module-replacement/#enabling-hmr) mode and starts a webpack dev server that sends hot updates to the renderer process:
26 |
27 | ```bash
28 | npm start
29 | ```
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | meta.json
3 |
4 | # Logs
5 | logs
6 | *.log
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 |
13 | # Directory for instrumented libs generated by jscoverage/JSCover
14 | lib-cov
15 |
16 | # Coverage directory used by tools like istanbul
17 | coverage
18 |
19 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
20 | .grunt
21 |
22 | # node-waf configuration
23 | .lock-wscript
24 |
25 | # Compiled binary addons (http://nodejs.org/api/addons.html)
26 | build/Release
27 | .eslintcache
28 |
29 | # Dependency directory
30 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
31 | node_modules
32 |
33 | # OSX
34 | .DS_Store
35 |
36 | .idea
37 | npm-debug.log.*
38 | lib
39 |
40 | # dependencies
41 | /node_modules
42 |
43 | # production
44 | /build
45 |
46 | # generated files
47 | .docusaurus
48 | .cache-loader
49 |
50 | # misc
51 | .DS_Store
52 | .env.local
53 | .env.development.local
54 | .env.test.local
55 | .env.production.local
56 |
57 | npm-debug.log*
58 |
--------------------------------------------------------------------------------
/docs/packaging.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: packaging
3 | title: Packaging
4 | sidebar_label: Packaging
5 | ---
6 |
7 | To package apps for the local platform:
8 |
9 | ```bash
10 | npm run package
11 | ```
12 |
13 | The packaged app will be inside the `release` directory.
14 |
15 | To package apps with options:
16 |
17 | ```bash
18 | npm run package -- --[option]
19 | # Example: npm run package -- --mac
20 | ```
21 |
22 | ### Debugging Production Builds
23 |
24 | You can debug your production build with devtools by simply setting the `DEBUG_PROD` env variable
25 |
26 | ```bash
27 | npx cross-env DEBUG_PROD=true npm run package
28 | ```
29 |
30 | ## Notarizing
31 |
32 | To notarize your macOS app, you will need to set the following environment variables:
33 |
34 | - `APPLE_ID` - Your Apple ID
35 | - `APPLE_APP_SPECIFIC_PASSWORD` - Your Apple ID password
36 |
37 | In `package.json` -> `build` -> `mac` the `teamId` key needs to be set:
38 |
39 | ```
40 | "notarize": {
41 | "teamId": "YOUR_TEAM_ID"
42 | }
43 | ```
44 |
45 | This above config will automatically get electron-builder to notarize the build.
46 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018-present Electron React Boilerplate
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/pages/styles.module.css:
--------------------------------------------------------------------------------
1 | /**
2 | * CSS files with the .module.css suffix will be treated as CSS modules
3 | * and scoped locally.
4 | */
5 |
6 | .heroBanner {
7 | padding: 4rem 0;
8 | text-align: center;
9 | position: relative;
10 | overflow: hidden;
11 | background: linear-gradient(
12 | 200.96deg,
13 | #fedc2a -29.09%,
14 | #dd5789 51.77%,
15 | #7a2c9e 129.35%
16 | );
17 | }
18 |
19 | @media screen and (max-width: 966px) {
20 | .heroBanner {
21 | padding: 2rem;
22 | }
23 | }
24 |
25 | .getStarted {
26 | background-color: white;
27 | padding: 10px 20px;
28 | border-radius: 10px;
29 | border: none;
30 | appearance: none;
31 | font-size: 1.3rem;
32 | box-shadow: 0px 8px 28px -6px rgba(24, 39, 75, 0.12),
33 | 0px 18px 88px -4px rgba(24, 39, 75, 0.14);
34 | transition: transform ease-in 0.1s;
35 | cursor: pointer;
36 | color: black;
37 | }
38 |
39 | .getStarted:hover {
40 | transform: scale(1.05);
41 | color: black;
42 | }
43 |
44 | .features {
45 | display: flex;
46 | align-items: center;
47 | padding: 2rem 0;
48 | width: 100%;
49 | }
50 |
51 | .featureImage {
52 | height: 200px;
53 | width: 200px;
54 | }
55 |
--------------------------------------------------------------------------------
/docs/dev-tools.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: dev-tools
3 | title: DevTools
4 | sidebar_label: DevTools
5 | ---
6 |
7 | ### Toggle Chrome DevTools
8 |
9 | - OS X: Cmd Alt I or F12
10 | - Linux: Ctrl Shift I or F12
11 | - Windows: Ctrl Shift I or F12
12 |
13 | _See [electron-debug](https://github.com/sindresorhus/electron-debug) for more information._
14 |
15 | ### DevTools extension
16 |
17 | This boilerplate includes the following DevTools extensions:
18 |
19 | - [Devtron](https://github.com/electron/devtron) - Install via [electron-debug](https://github.com/sindresorhus/electron-debug).
20 | - [React Developer Tools](https://github.com/facebook/react-devtools) - Install via [electron-devtools-installer](https://github.com/GPMDP/electron-devtools-installer).
21 | - [Redux DevTools](https://github.com/zalmoxisus/redux-devtools-extension) - Install via [electron-devtools-installer](https://github.com/GPMDP/electron-devtools-installer).
22 |
23 | You can find the tabs on Chrome DevTools.
24 |
25 | If you want to update extensions version, please set `UPGRADE_EXTENSIONS` env, just run:
26 |
27 | ```bash
28 | UPGRADE_EXTENSIONS=1 npm start
29 |
30 | # For Windows
31 | set UPGRADE_EXTENSIONS=1 && npm start
32 | ```
33 |
--------------------------------------------------------------------------------
/crowdin.yaml:
--------------------------------------------------------------------------------
1 | project_identifier_env: CROWDIN_DOCUSAURUS_PROJECT_ID
2 | api_key_env: CROWDIN_DOCUSAURUS_API_KEY
3 | base_path: "./"
4 | preserve_hierarchy: true
5 |
6 | files:
7 | - source: "/docs/*.md"
8 | translation: "/translated_docs/%locale%/%original_file_name%"
9 | languages_mapping: &anchor
10 | locale:
11 | "af": "af"
12 | "ar": "ar"
13 | "bs-BA": "bs-BA"
14 | "ca": "ca"
15 | "cs": "cs"
16 | "da": "da"
17 | "de": "de"
18 | "el": "el"
19 | "es-ES": "es-ES"
20 | "fa": "fa-IR"
21 | "fi": "fi"
22 | "fr": "fr"
23 | "he": "he"
24 | "hu": "hu"
25 | "id": "id-ID"
26 | "it": "it"
27 | "ja": "ja"
28 | "ko": "ko"
29 | "mr": "mr-IN"
30 | "nl": "nl"
31 | "no": "no-NO"
32 | "pl": "pl"
33 | "pt-BR": "pt-BR"
34 | "pt-PT": "pt-PT"
35 | "ro": "ro"
36 | "ru": "ru"
37 | "sk": "sk-SK"
38 | "sr": "sr"
39 | "sv-SE": "sv-SE"
40 | "tr": "tr"
41 | "uk": "uk"
42 | "vi": "vi"
43 | "zh-CN": "zh-CN"
44 | "zh-TW": "zh-TW"
45 | "en-UD": "en-UD"
46 | - source: "/versioned_docs/**/*.md"
47 | translation: "/translated_docs/%locale%/**/%original_file_name%"
48 | languages_mapping: *anchor
49 | - source: "/i18n/en.json"
50 | translation: "/i18n/%locale%.json"
51 | languages_mapping: *anchor
52 |
--------------------------------------------------------------------------------
/docs/tool-tips.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: tool-tips
3 | title: Tooling Tips
4 | sidebar_label: Tooling Tips
5 | ---
6 |
7 | This page is intended for sharing less known tips about tools used in this boilerplate. Tools are computer programs that are used to maintain and support electron-react-boilerplate. For example, `git`, `yarn`, `npm` etc.
8 |
9 | ## Keeping commit history clean
10 |
11 | When you clone this project and down the line keep your copy updated with the upstream, you end up with lot many commits that are made by contributors to this boilerplate. Meanwhile you too keep committing in your copy in order to develop your project. You may feel that your `git log` is polluted with commits made to this boilerplate, when you prefer `git log` to show only those commits that are directly related to your project.
12 |
13 | One workaround is to use `--depth 1` switch in your `git clone` and `git fetch` command.
14 |
15 | For example,
16 |
17 | ```bash
18 | # When cloning this boilerplate for the first time
19 | git clone --depth=1 https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
20 | # To fetch updated copy of boilerplate
21 | git fetch --depth 1 git@github.com:electron-react-boilerplate/electron-react-boilerplate.git
22 | ```
23 |
24 | ### Further Readings:
25 |
26 | - [`git clone` documentation](https://git-scm.com/docs/git-clone)
27 | - [`git fetch` documentation](https://git-scm.com/docs/git-fetch)
28 | - [Question: Best way to clean repository after initializing new project? #782](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/782)
29 |
--------------------------------------------------------------------------------
/docs/editor-configuration.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: editor-configuration
3 | title: Editor Configuration
4 | sidebar_label: Editor Configuration
5 | ---
6 |
7 | import Tabs from '@theme/Tabs';
8 | import TabItem from '@theme/TabItem';
9 |
10 | ;
24 | }
25 | ```
26 |
27 | ## Run-time Assets
28 |
29 | In the context of ERB, run-time assets are separate files that are included in the packaged application and used through file paths. You will need to include their locations in `package.json['build']['files']`. This is so that [electron-builder's configuration](https://www.electron.build/configuration/contents#files) knows to include them when packaging.
30 |
31 | (Note that these locations are relative to the `release/app` directory)
32 |
33 | ```jsonc
34 | "build": {
35 | // ...
36 | "files": [
37 | "my-files/"
38 | // ...
39 | ],
40 | }
41 | ```
42 |
43 | For example, you can include Python within your electron app and call it at run-time to print `Hello World from Python`.
44 |
45 | ```ts
46 | const pythonBinary = path.join(__dirname, "assets", "python");
47 | const pythonScript = 'print("Hello World from Python")';
48 | exec(`echo '${pythonScript}' | ${pythonBinary}`, (error, stdout) => {
49 | console.log(`stdout: ${stdout}`);
50 | });
51 | ```
52 |
53 | [Here is a runnable example of this](https://github.com/electron-react-boilerplate/examples/commit/d1eddcd0e30ec22edd3fd3900ee3c12e1da4cdba)
54 |
55 | A useful tip is using `asar` (the format that `electron-builder` packages into) to see the contents of the packaged build. You will see that it contains content included within `package.json['build']['files']`.
56 |
57 | ```bash
58 | asar list release/mac/ElectronReact.app/Contents/Resources/app.asar
59 | ```
60 |
--------------------------------------------------------------------------------
/docs/upgrade-guide.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: upgrade-guide
3 | title: Upgrade Guide
4 | sidebar_label: Upgrade Guide
5 | ---
6 |
7 | This project moves pretty quickly and demonstrates the best practices of JavaScript, Electron, and React. Keep in mind that this is a boilerplate project with a purposefully tiny feature set (a counter). The boilerplate will enable you to build an advanced app with a large feature set, and over time your advanced app will diverge from the simple feature set of the boilerplate.
8 |
9 |
10 | #### Keeping the boilerplate updated
11 |
12 | If your application is a fork from this repo, you can add this repo to another git remote:
13 |
14 | ``` sh
15 | git remote add upstream https://github.com/electron-react-boilerplate/electron-react-boilerplate.git
16 | ```
17 |
18 | Then, use git to merge some latest commits:
19 |
20 | ``` sh
21 | git pull upstream main
22 | ```
23 |
24 | #### Tips for keeping your app modernized
25 |
26 | - Track explanations of the changes between versions in this [Upgrade Guide](https://electron-react-boilerplate.js.org/docs/upgrade-guide#ugrading-to-0170-from-0160) and in the [CHANGELOG](https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/next/CHANGELOG.md).
27 | - Try merging new releases into your project, especially early on, but expect your project to evolve beyond the boilerplate and for merging upstream changes into your project to become untenable.
28 | - Subscribe to changes from this repo. Even if you can't merge every change into your project, watching changes from this repo will help ensure you don't miss major changes, and help you appreciate the smaller ones.
29 | - If something breaks in your app, try it in the boilerplate. Seeing if something works in the boilerplate can help you understand if it's a configuration issue inherited by the boilerplate or something you broke on your own. This is especially relevant for building native modules, Webpack config changes, babel config changes, additional renderer processes, etc.
30 | - Be realistic about what this project gives you. The boilerplate is meant to be a working educational example. It's a demonstration, not a black-box development framework for you to build on top of. Inspect the boilerplate, understand how it works, and tweak your app to meet your needs.
31 |
--------------------------------------------------------------------------------
/docs/roadmap.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: roadmap
3 | title: Roadmap
4 | sidebar_label: Roadmap
5 | ---
6 |
7 | ## Release v2.0.0
8 |
9 | - Migrate to `webpack@5`
10 | - React fast refresh
11 | - Drop Redux integration
12 | - Add macOS notarize support
13 | - Simplify directory structure
14 | - Remove counter app boilerplate example
15 | - Migrate to `electron@11`
16 |
17 | ## Release v1.2.0
18 |
19 | - Migrate to [redux-toolkit](https://redux-toolkit.js.org/)
20 |
21 | ## Future Releases
22 |
23 | ## Release v1.4.0
24 |
25 | - Drop redux support
26 | - Restore electron preload as default
27 | - Auto update integration
28 | - Enhanced vscode debugger intetgration
29 | - Migrate to hooks
30 | - Publishing to web and ERB
31 | - Hot reload main process
32 | - docs
33 | - using binary assets at runtime
34 | - tray ERB app
35 | - Examples with bootstrap
36 | - Examples with material-ui
37 | - Video tutorial series
38 |
39 | # ✅ Past Releases
40 |
41 | ## Release v1.0.0
42 |
43 | #### Migrate to TypeScript from Flow
44 |
45 | This is currently a work in progress for the ERB team. The reason why we waited for a while before migrating to TypeScript is because we wanted users to use ESLint and TypeScript as opposed to TypeScript and TSLint. ESLint and TypeScript integration was initially unstable and experimental so we wanted to wait a while before migrating. Now that the tooling is more stable, we have recently started working on the migration.
46 |
47 | #### Disabling Sourcemaps in Production
48 |
49 | Sourcemaps allow developers to map compiled code to source code. This makes debugging easier but when sourcemaps are shipped in production, they allow consumers of the application to view the original source code of the application. This is an issue for proprietary applications that depend on electron-react-boilerplate. As a result, sourcemaps will be disabled in production in `0.19.0`.
50 |
51 | #### Disabling Node Integration in Renderer
52 |
53 | For context, see [electron/electron/issues/5113](https://github.com/electron/electron/issues/5113).
54 |
55 | #### Migrate to Azure Pipelines
56 |
57 | Azure Pipelines allows concurrent builds for Windows, MacOS, and Linux. Rather than using Travis CI and Appveyor, Azure Pipelines will allow us to use a single CI for all platforms. While Travis CI does support Windows we've noticed that builds on it tend to be slow and the Windows builds tend to be unreliable and flaky.
58 |
--------------------------------------------------------------------------------
/docs/electron-store.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: electron-store
3 | title: Electron Store
4 | sidebar_label: Electron Store
5 | ---
6 |
7 | ## Using `electron-store` with `electron-react-boilerplate`
8 |
9 | ### 1. Install `electron-store`
10 |
11 | ```bash
12 | npm install electron-store
13 | ```
14 |
15 | ### 2. Electron IPC Configuration
16 |
17 | Electron strongly recommends disabling node integration in the renderer process, which is now the default. IPC is required to securely pass values between the main and renderer processes. You will have to add IPC event handlers which set and get `electron-store` through the `preload` script.
18 |
19 | Add the following event handlers to your preload script:
20 |
21 | ```ts title="src/main/preload.js"
22 | const { contextBridge, ipcRenderer } = require('electron');
23 |
24 | contextBridge.exposeInMainWorld('electron', {
25 | store: {
26 | get(key) {
27 | return ipcRenderer.sendSync('electron-store-get', key);
28 | },
29 | set(property, val) {
30 | ipcRenderer.send('electron-store-set', property, val);
31 | },
32 | // Other method you want to add like has(), reset(), etc.
33 | },
34 | // Any other methods you want to expose in the window object.
35 | // ...
36 | });
37 | ```
38 |
39 | Add event listeners in your main process:
40 |
41 | ```ts title="src/main/main.ts"
42 | import Store from 'electron-store';
43 |
44 | const store = new Store();
45 |
46 | // IPC listener
47 | ipcMain.on('electron-store-get', async (event, val) => {
48 | event.returnValue = store.get(val);
49 | });
50 | ipcMain.on('electron-store-set', async (event, key, val) => {
51 | store.set(key, val);
52 | });
53 | ```
54 |
55 | ### 3. Add typings
56 |
57 | Add the following type defs:
58 |
59 | ```ts title="src/renderer/preload.d.ts"
60 | // ...
61 |
62 | declare global {
63 | interface Window {
64 | electron: {
65 | store: {
66 | get: (key: string) => any;
67 | set: (key: string, val: any) => void;
68 | // any other methods you've defined...
69 | };
70 | };
71 | }
72 | }
73 | ```
74 |
75 | ---
76 |
77 | Now, you can set and get `electron-store` in your renderer processes:
78 |
79 | ```tsx title="src/renderer/App.tsx"
80 | // ...
81 |
90 | ```
91 |
--------------------------------------------------------------------------------
/docs/auto-update.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: auto-update
3 | title: Auto Update
4 | sidebar_label: Auto Update
5 | ---
6 |
7 | ## Requirements
8 |
9 | - [Apple Developer Certificate](https://www.electron.build/code-signing#where-to-buy-code-signing-certificate) (if targeting macOS)
10 | - [Windows Developer Certificate](https://www.electron.build/code-signing#where-to-buy-code-signing-certificate) (if targeting Windows)
11 |
12 | ## Auto Updates
13 |
14 | Electron works with auto updates out of the box.
15 |
16 | **1. Update Env Variables**
17 |
18 | To get started you'll need to configure the following environmental variables, which [electron-builder uses to sign your app](https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/ebf4120619254ec8df1051275b7c95674aa7114b/.github/workflows/publish.yml#L36-L39):
19 |
20 | | Variable Name | How to get it |
21 | | ------------------ | ---------------------------------------------------------------------------------------------- |
22 | | `APPLE_ID` | Your Apple ID |
23 | | `APPLE_ID_PASS` | Your Apple password (use an app [specific password](https://support.apple.com/en-us/HT204397)) |
24 | | `CSC_LINK` | [code-signing](https://www.electron.build/code-signing.html) |
25 | | `CSC_KEY_PASSWORD` | [code-signing](https://www.electron.build/code-signing.html) |
26 |
27 | https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/main/package.json#L34-L35
28 |
29 | See electron-builder's docs for more details:
30 |
31 | - https://www.electron.build/auto-update
32 | - https://www.electron.build/code-signing.html
33 |
34 | **2. Update App Config**
35 |
36 | Update the [`productName` and `appId`](https://github.com/electron-react-boilerplate/electron-react-boilerplate/blob/158fb1167b37d5cc74a3a3fbcf8523ece9d29806/package.json#L33-L34).
37 |
38 | **3. Configure Your Server**
39 |
40 | Auto update assets need to be published somewhere. For open source apps, its convenient and free to publish via [github releases](https://github.com/electron-react-boilerplate/electron-react-boilerplate/releases), which electron-react-boilerplate does out of the box. Electron-builder [doesn't recommend using github releases](https://www.electron.build/auto-update#private-github-update-repo) publish private apps. Instead you should host your releases you can host your own server
41 |
42 | See [electron-builder's publish docs](https://www.electron.build/configuration/publish) for more details.
43 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | # ******** NOTE ********
12 |
13 | name: "CodeQL"
14 |
15 | on:
16 | push:
17 | branches: [main]
18 | pull_request:
19 | # The branches below must be a subset of the branches above
20 | branches: [main]
21 | schedule:
22 | - cron: "21 10 * * 6"
23 |
24 | jobs:
25 | analyze:
26 | name: Analyze
27 | runs-on: ubuntu-latest
28 |
29 | strategy:
30 | fail-fast: false
31 | matrix:
32 | language: ["javascript"]
33 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
34 | # Learn more...
35 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
36 |
37 | steps:
38 | - name: Checkout repository
39 | uses: actions/checkout@v2
40 |
41 | # Initializes the CodeQL tools for scanning.
42 | - name: Initialize CodeQL
43 | uses: github/codeql-action/init@v1
44 | with:
45 | languages: ${{ matrix.language }}
46 | # If you wish to specify custom queries, you can do so here or in a config file.
47 | # By default, queries listed here will override any specified in a config file.
48 | # Prefix the list here with "+" to use these queries and those in the config file.
49 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
50 |
51 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52 | # If this step fails, then you should remove it and run the build manually (see below)
53 | - name: Autobuild
54 | uses: github/codeql-action/autobuild@v1
55 |
56 | # ℹ️ Command-line programs to run using the OS shell.
57 | # 📚 https://git.io/JvXDl
58 |
59 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60 | # and modify them (or add more) to build your code if your project
61 | # uses a compiled language
62 |
63 | #- run: |
64 | # make bootstrap
65 | # make release
66 |
67 | - name: Perform CodeQL Analysis
68 | uses: github/codeql-action/analyze@v1
69 |
--------------------------------------------------------------------------------
/docs/component-tests.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: component-tests
3 | title: Component Tests
4 | sidebar_label: Component Tests
5 | ---
6 |
7 | Component tests in ERB use [Jest](https://jestjs.io) and [Enzyme](https://github.com/airbnb/enzyme). While Jest is popular for React testing, it is also capable of testing Node applications as well. Enzyme provides some utilities that make it easier to test React applications.
8 |
9 | ## Writing Component Tests
10 |
11 | By convention, all component test modules have the following filename suffix: `.spec.js`. An example of test module filename would be `Counter.spec.js`.
12 |
13 | We start by writing a function that will setup the actions of our component and importing the necessary modules:
14 |
15 | ```js title="tests/Counter.spec.js"
16 | import { spy } from "sinon";
17 | import React from "react";
18 | import Enzyme, { shallow } from "enzyme";
19 | import Adapter from "enzyme-adapter-react-16";
20 | import renderer from "react-test-renderer";
21 | import Counter from "../../src/components/Counter";
22 |
23 | Enzyme.configure({ adapter: new Adapter() });
24 | function setup() {
25 | const actions = {
26 | increment: spy(),
27 | incrementIfOdd: spy(),
28 | incrementAsync: spy(),
29 | decrement: spy(),
30 | };
31 | const component = shallow(
{description}
53 |{siteConfig.tagline}
69 |