1- # ** Electron-React-TypeScript-Webpack-Boilerplate**
2-
1+ # Electron-React-TypeScript-Webpack-Boilerplate
32Pre-configured Electron.js + React.js + TypeScript boilerplate with
43Webpack v4 & linters config predefined.
54
6- This boilerplate works on Mac, Windows, and Linux.
7- If something doesn't work, please [ file and issue] ( https://github.com/Devtography/electron-react-typescript-webpack-boilerplate/issues/new ) .
5+ This boilerplate currently works on macOS and Windows. If something doesn't
6+ work, please [ file and issue] ( https://github.com/Devtography/electron-react-typescript-webpack-boilerplate/issues/new ) .
87
9- ## ** How Does It Work? **
10- ```
8+ ## Getting started
9+ ``` bash
1110// execute
1211git clone https://github.com/iamWing/electron-react-typescript-base-proj.git
1312```
1413
15- ```
14+ ``` json
1615// edit the following fields in package.json for your own project
1716{
1817 "name" : {your-project-name },
@@ -22,19 +21,71 @@ git clone https://github.com/iamWing/electron-react-typescript-base-proj.git
2221 "appId" : {your-app-id },
2322 "productName" : {your-product-name },
2423 "buildVersion" : {whatever-you-like }
25- }
24+ },
2625 "author" : {who's-the-author? },
27- "license": {if-you-don't-want-to-use-MIT}
26+ "license" : {if-you-don't-want-to-use-MIT },
2827 "repository" : {type-and-link-of-your-repo },
2928 "keywords" : {keywords-of-your-project },
3029 "bugs" : {issue-page-of-your-repo },
3130 "homepage" : {homepage-of-your-repo }
3231}
3332```
3433
35- Then execute ` npm run dev ` to start develop your app.
34+ Then install all the ` node_modules ` needed by executing the following command:
35+ ``` bash
36+ cd {folder-containing-the-cloned-boilerplate}
37+ npm run install
38+ ```
39+
40+ Finally execute the following command to start Webpack in development mode and
41+ watch the changes on source files.
42+ ``` bash
43+ npm run dev
44+ ```
45+
46+ ## Building the installer for your Electron app
47+ The boilerplate is currently configured to package & build the installer of
48+ your app for macOS & Windows using ` electron-builder ` .
49+
50+ For macOS, execute:
51+ ``` bash
52+ npm run build:mac
53+ ```
54+
55+ For Windows, execute:
56+ ``` bash
57+ npm run build:win
58+ ```
59+ _ ** ` asar ` archiving is disabled by default in Windows build as it can cause
60+ errors while running the installed Electron app based on pervious experiences,
61+ whereas the macOS build with ` asar ` enabled works just fine. You can turn it
62+ back on by removing line 23 (` "asar": false ` ) in ` package.json ` . ** _
63+
64+ ### Extra options
65+ The build scripts are pre-configured to build 64 bit installers since 64 bit
66+ should be the standard for a modern applications. 32 bit builds are still
67+ possible by changing the build scripts in ` package.json ` as below:
68+ ``` json
69+ // from
70+ "scripts" : {
71+ ...
72+ "build:win" : " electron-builder build --win --x64" ,
73+ "build:mac" : " electron-builder build --mac --x64"
74+ },
3675
37- ## ** Folder structure**
76+ // to
77+ "scripts" : {
78+ ...
79+ "build:win" : " electron-builder build --win --ia32" ,
80+ "build:mac" : " electron-builder build --mac --ia32"
81+ },
82+ ```
83+
84+ Builds for Linux, armv71, and arm64 can also be configured by modifying the
85+ build scripts in ` package.json ` , but those aren't tested yet. For details,
86+ please refer to [ documents of ` electron-builder ` ] ( https://www.electron.build/cli ) .
87+
88+ ## Folder structure
3889```
3990electron-react-typescript-base-proj/
4091| - dist/ //- Generated by Webpack automatically
@@ -44,13 +95,14 @@ electron-react-typescript-base-proj/
4495| | - index.html
4596| | - style.css
4697| - src/
47- | | - main/ //- Electron / backend modules
98+ | | - main/ //- Backend modules for the Electron app
4899| | | - main.ts //- Entry point of 'electron-main'
49100| | - models/
50- | | - renderer/ //- React / frontend components
101+ | | - renderer/ //- Frontend React components for the Electron app
51102| | | - renderer.tsx //- Entry point of 'electron-renderer'
52103| | - utils/ //- Common utilities
53104| - test/ //- Unit tests
105+ | - .eslintrc //- ESLint config
54106| - .gitignore
55107| - package-lock.json
56108| - package.json
@@ -59,7 +111,6 @@ electron-react-typescript-base-proj/
59111| - webpack.config.js //- Webpack config
60112```
61113
62- ## ** License**
63-
114+ ## License
64115Electron React TypeScript Webpack Boilerplate is open source software
65116[ licensed as MIT] ( LICENSE ) .
0 commit comments