chore(docs): UPDATE

This commit is contained in:
草鞋没号 2021-11-12 09:01:59 +08:00
parent f9fe287fd0
commit 6f484d2d81
2 changed files with 40 additions and 4 deletions

View File

@ -43,17 +43,35 @@
```
#### `dist` and `src`
- Once `npm run dev` or `npm run build` is executed. Will be generated `dist`, it is the same as the `src` structure.
- This ensures the accuracy of path calculation.
```tree
├── dist
| ├── main
| ├── preload
| ├── renderer
├── src
| ├── main
| ├── preload
| ├── renderer
|
```
## How to work
- The Main-process, Renderer-process and Preload-script are all config in `configs/xxx.ts`
- The `Main-process`, `Renderer-process` and `Preload-script` are all config in `configs/xxx.ts`.
- The full-scale `Vite` compilation is supper fast
- All files are built using `Vite`, is supper fast.
- `scripts/build.mjs` only calls the `Vite` API and uses the `configs/xxx.ts` config file to build
- `scripts/build.mjs` only calls the `Vite` API and uses the `configs/xxx.ts` config file to build.
- The difference between `scripts/watch.mjs` and `build.mjs` is that the watch option is configured for the Main-process and Preload-script. The Renderer-process uses `require ('vite').createServer`
- The whole project tends to be configured rather than a large number of scripts, which is dazzling -- **🥳 上手简单**
- Manage projects more through configuration other than scripts. -- **🥳 Simple and clear**
## Demo

View File

@ -44,6 +44,24 @@
```
#### dist 与 src
- 一旦启动或打包脚本执行过,会在根目录产生 **`dist` 文件夹,里面的文件夹同 `src` 一模一样**
- 在使用一些路径计算时,尤其是相对路径计算;`dist` 与 `src` 里面保持相同的目录结构能避开好多问题
```tree
├── dist
| ├── main
| ├── preload
| ├── renderer
├── src
| ├── main
| ├── preload
| ├── renderer
|
```
## 原理
- 主进程(main-process)、渲染进程(renderer-process)、预加载脚本(preload-script) 全部在 `configs/xxx.ts` 中配置 -- 全量级的 `Vite` 编译还是相当快的