Skip to content

Commit e76a9cb

Browse files
authored
Merge pull request #63 from Owen-Tsai/main
Chore: i18n
2 parents 82a507f + d3e5a0e commit e76a9cb

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212

1313
## Overview
1414

15-
This is an `Electron` category integration template that pursues simplification.
16-
This contains only the most basic files, the most basic dependencies, and the most basic functions. Instead of large and complex design.
17-
The purpose of this is to ensure that the template is flexible enough.
15+
This is a `Vite`-integrated `Electron` template built with simplification in mind.
1816

19-
For all that, I still hope that you have a basic understanding for `Electron` `Vite`. Because in addition to the simple structure of the project, the `README` also appears too simplify.
17+
The repo contains only the most basic files, dependencies and functionalities to ensure flexibility for various scenarios.
2018

21-
You can learn more details by looking at the source code. Trust me, this template is the simple enough. 😋
19+
You need a basic understanding of `Electron` and `Vite` to get started. But that's not mandatory - you can learn almost all the details by reading through the souce code. Trust me, this repo is not that complex. 😋
2220

2321
## Run Setup
2422

@@ -38,17 +36,17 @@ You can learn more details by looking at the source code. Trust me, this templat
3836

3937
## Directory
4038

41-
Once `dev` or `build` npm-script executed will be generate named `dist` folder. It has children dir of same as `packages` folder, the purpose of this design can ensure the correct path calculation.
39+
A `dist` folder will be generated everytime when `dev` or `build` command is executed. File structure of `dist` is identical to the `packages` directory to avoid any potential path calculation errors.
4240

4341
```tree
4442
45-
├── dist After build, it's generated according to the "packages" directory
43+
├── dist Will be generated following the structure of "packages" directory
4644
├ ├── main
4745
├ ├── preload
4846
├ ├── renderer
4947
5048
├── scripts
51-
├ ├── build.mjs Develop script -> npm run build
49+
├ ├── build.mjs Build script -> npm run build
5250
├ ├── watch.mjs Develop script -> npm run dev
5351
5452
├── packages
@@ -63,9 +61,11 @@ Once `dev` or `build` npm-script executed will be generate named `dist` folder.
6361

6462
## Use Electron, NodeJs API
6563

66-
> 🚧 By default, Electron don't support the use of API related to Electron and NodeJs in the Renderer-process, but someone still need to use it. If so, you can see the template 👉 **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
64+
> 🚧 By default, using Electron or NodeJS API in the rederer process is strongly discouraged. For anyone who needs to bypass the security constraints, take a look at this template 👉 **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
6765
68-
#### All Electron, NodeJs API invoke passed `Preload-script`
66+
As electron suggested, if you need access to the Electron and NodeJS API in the renderer process, you need to create a context bridge and expose the APIs you need to the renderer process.
67+
68+
Note that if your project uses typescript, you also need to add type declarations to the `Window` interface.
6969

7070
* **packages/preload/index.ts**
7171

@@ -98,12 +98,11 @@ Once `dev` or `build` npm-script executed will be generate named `dist` folder.
9898

9999
## Use SerialPort, SQLite3 or other node-native addons in Main-process
100100

101-
- First, yout need to make sure the deps in "dependencies". Because the project still needs it after packaged.
101+
- First, you need to make sure the packages are listed in the "dependencies" since they are still needed at runtime after the project is packed.
102102

103-
- Main-process, Preload-script are also built with Vite, and they are just built as [build.lib](https://vitejs.dev/config/#build-lib).
104-
So they just need to configure Rollup.
103+
- Source code of main process and preload scripts are also bundled with Vite[build.lib](https://vitejs.dev/config/#build-lib). Rollup configurations needed.
105104

106-
**Click to see more** 👉 [packages/main/vite.config.ts](https://github.com/caoxiemeihao/electron-vue-vite/blob/main/packages/main/vite.config.ts)
105+
**More:** 👉 [packages/main/vite.config.ts](https://github.com/caoxiemeihao/electron-vue-vite/blob/main/packages/main/vite.config.ts)
107106

108107
```js
109108
export default {
@@ -127,11 +126,11 @@ export default {
127126

128127
## `dependencies` vs `devDependencies`
129128

130-
- First, you need to know if deps(npm package) are still needed after packaged.
129+
- First, you need to know if the package is still needed at runtime after packed.
131130

132-
- Like [serialport](https://www.npmjs.com/package/serialport), [sqlite3](https://www.npmjs.com/package/sqlite3) they are node-native module and should be placed in `dependencies`. In addition, Vite will not build them, but treat them as external modules.
131+
- Packages like [serialport](https://www.npmjs.com/package/serialport), [sqlite3](https://www.npmjs.com/package/sqlite3) are node-native modules and should be placed in `dependencies`. Vite will not build them and will treat them as externals.
133132

134-
- Like [vue](https://www.npmjs.com/package/vue), [react](https://www.npmjs.com/package/react) they are pure javascript module and can be built with Vite, so they can be placed in `devDependencies`. This reduces the volume of the built project.
133+
- Packages like [vue](https://www.npmjs.com/package/vue), [react](https://www.npmjs.com/package/react) are pure javascript modules and can be built with Vite. They can be listed in `devDependencies` which helps reducing the size of bundled product.
135134

136135
## Main window
137136
<img width="400px" src="https://raw.githubusercontent.com/caoxiemeihao/blog/main/electron-vue-vite/screenshot/electron-15.png" />

0 commit comments

Comments
 (0)