From 6f484d2d81033fc2c90b81a135834327f2cad3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Fri, 12 Nov 2021 09:01:59 +0800 Subject: [PATCH] chore(docs): UPDATE --- README.md | 26 ++++++++++++++++++++++---- README.zh-CN.md | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40cee43..fba57a2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README.zh-CN.md b/README.zh-CN.md index be99cd0..a1ac58d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -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` 编译还是相当快的