Skip to content

Commit bc0dee5

Browse files
committed
refactor(global): cleanup, more comments
1 parent d8356dc commit bc0dee5

File tree

8 files changed

+31
-12
lines changed

8 files changed

+31
-12
lines changed

Diff for: .config/forge.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = {
7373
entryPoints: [
7474
{
7575
html: "./src/render/index.html",
76-
js: "./src/render/renderer.ts",
76+
js: "./src/renderer.ts",
7777
name: "main_window",
7878
preload: {
7979
js: "./src/preload.ts",

Diff for: .config/webpack.main.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
* This is the main entry point for your application, it's the first file
66
* that runs in the main process.
77
*/
8-
entry: "./src/index.ts",
8+
entry: "./src/main.ts",
99
// Put your normal webpack config below here
1010

1111
module: {

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ yarn create-icons
120120

121121
- Routes.tsx # react-router routes
122122

123-
- renderer.ts # main electron renderer entry
124-
125123
- App.tsx # Export entire app with routes components
126124
# and redux provider if you are using it
127125

128126
-
129127

130-
index.ts # main electron entry
128+
main.ts # main "backend" electron entry
129+
130+
renderer.ts # main "frontend" electron renderer entry
131131

132-
preload.ts # electron preload
132+
preload.ts # main "entry to frontend" electron preload entry
133133

134134
```
135135

Diff for: src/app/ipc/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ ipcMain.on("relaunch-app", () => {
2222
});
2323

2424
// In this file you can include the rest of your app's specific main process
25-
// code. You can also put them in separate files and import them in index.ts.
25+
// code. You can also put them in separate files and import them in main.ts.

Diff for: src/index.ts renamed to src/main.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* This file will automatically be loaded by electron and run in the "main" context.
3+
* This is your "backend"
4+
* To learn more about the differences between the "main" and the "renderer" context in
5+
* Electron, visit:
6+
*
7+
* https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
8+
*/
9+
110
import { app, BrowserWindow } from "electron";
211
import isDev from "electron-is-dev";
312
import Store from "electron-persist-secure/lib/store";

Diff for: src/preload.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
import '../bridges/index';
1+
/**
2+
* This file will automatically be loaded by electron and run in the "preload-scripts" context with Node.js API access (even though its in the renderer).
3+
* This is your "priveleged entry to frontend"
4+
* To learn more about the differences between the "preload-scripts" and the "renderer" context in
5+
* Electron, visit:
6+
*
7+
* https://www.electronjs.org/docs/tutorial/process-model#preload-scripts
8+
*/
9+
10+
import "../bridges/index";

Diff for: src/render/redux/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const persistConfig = {
2828
const persistedReducer = persistReducer(
2929
persistConfig,
3030
combineReducers({
31-
count: countReducer,
31+
counter: countReducer,
3232
char: charReducer,
3333
})
3434
);

Diff for: src/render/renderer.ts renamed to src/renderer.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/**
2-
* This file will automatically be loaded by webpack and run in the "renderer" context.
2+
* This file will automatically be loaded by electron and run in the "renderer" context with no access to Node.js APIs (except thru the contextBridge).
3+
* This is your "frontend"
34
* To learn more about the differences between the "main" and the "renderer" context in
45
* Electron, visit:
56
*
67
* https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
78
*/
89

910
import ReactDOM from "react-dom";
10-
import App from "./App";
11-
import "./index.css";
11+
import App from "./render/App";
12+
import "./render/index.css";
1213

1314
function render() {
1415
ReactDOM.render(App(), document.getElementById("root"));

0 commit comments

Comments
 (0)