docs: add chinese simplified language support
This commit is contained in:
1 parent
4fbe5a4dbc
commit
cc039144e7
16 files changed
+477
-2
No files matched your search
@@ -0,0 +1,23 @@
|
||||
---
|
||||
order: 4
|
||||
---
|
||||
|
||||
# 自动测试
|
||||
|
||||
**Vutron**包括自动测试。测试框架使用微软的\*\*[Playwright](https://playwright.dev)。
|
||||
|
||||
**Playwright**针对网络应用测试进行了优化,并完全支持**Electron**框架。它易于安装,无需配置即可立即开始测试,并且是跨平台的。您可以在此处了解有关**Playwright**的更多信息:https://github.com/microsoft/playwright
|
||||
|
||||
此模板仅对模板主屏幕进行了非常简单的启动和行为测试。高级测试取决于您的应用程序范围。
|
||||
|
||||
目前,测试规范文件位于`tests`目录中,测试结果文件位于`tests/results`中。(内置测试规范文件不会生成单独的结果文件。)
|
||||
|
||||
Playwright配置文件位于项目根目录下的playwright.config.ts,更多信息请参阅以下文档:https://playwright.dev/docs/test-configuration
|
||||
|
||||
完成所有配置后,您可以使用以下命令进行测试。
|
||||
|
||||
```shell
|
||||
$ npm run test
|
||||
```
|
||||
|
||||
在运行测试之前,请清空构建目录(`dist`)并编译测试包。
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
order: 2
|
||||
---
|
||||
|
||||
# 构建配置
|
||||
|
||||
模块安装完成后,只需执行以下命令即可构建平台软件包。
|
||||
|
||||
```shell
|
||||
# For Windows (.exe, .appx)
|
||||
$ npm run build:win
|
||||
|
||||
# For macOS (.dmg)
|
||||
$ npm run build:mac
|
||||
|
||||
# For Linux (.rpm, .deb, .snap)
|
||||
$ npm run build:linux
|
||||
|
||||
# All platform (.exe, .appx, .dmg, .rpm, .deb, .snap) - see below description
|
||||
$ npm run build:all
|
||||
```
|
||||
|
||||
已构建的软件包可在 `release/{version}` 位置找到。
|
||||
|
||||
如需了解更多信息,请参阅以下文章: https://webpack.electron.build/dependency-management#installing-native-node-modules
|
||||
|
||||
## 多平台构建需要做些什么?
|
||||
|
||||
要为每个操作系统创建软件包,必须在相同的操作系统上构建。例如,macOS 的软件包必须在 macOS 机器上构建。
|
||||
|
||||
不过,你可以在一个操作系统上同时为 Windows、macOS 和 Linux 构建软件包。不过,这可能需要一些准备工作。
|
||||
|
||||
如果想在一个平台上同时构建多个平台,建议使用**macOS**。因为只需几个非常简单的设置就能对其进行配置。
|
||||
|
||||
您可以使用以下命令同时执行多平台构建。或者,你也可以通过上面的单独构建命令,只针对你想要的操作系统进行构建。
|
||||
|
||||
```shell
|
||||
$ npm run build:all
|
||||
```
|
||||
|
||||
Linux 构建可能需要 "Multipass" 配置。通过以下链接了解有关 `Multipass` 的更多信息: https://multipass.run
|
||||
|
||||
要了解有关多平台构建的更多信息,请参阅以下文章: https://electron.build/multi-platform-build
|
||||
|
||||
## 通过排除开发文件减少软件包大小
|
||||
|
||||
您可以通过在 `buildAssets/builder/config.ts` 的 files 属性中添加文件模式,在构建时排除不需要的文件。这将节省捆绑包的容量。
|
||||
|
||||
下面是一个不必要的 `node_modules` 文件模式,可以进一步节省捆绑包。根据项目情况,使用下面的规则可能会导致问题,因此请在使用前进行审查。
|
||||
|
||||
```json
|
||||
[
|
||||
"!**/.*",
|
||||
"!**/node_modules/**/{CONTRIBUTORS,CNAME,AUTHOR,TODO,CONTRIBUTING,COPYING,INSTALL,NEWS,PORTING,Makefile,htdocs,CHANGELOG,ChangeLog,changelog,README,Readme,readme,test,sample,example,demo,composer.json,tsconfig.json,jsdoc.json,tslint.json,typings.json,gulpfile,bower.json,package-lock,Gruntfile,CMakeLists,karma.conf,yarn.lock}*",
|
||||
"!**/node_modules/**/{man,benchmark,node_modules,spec,cmake,browser,vagrant,doxy*,bin,obj,obj.target,example,examples,test,tests,doc,docs,msvc,Xcode,CVS,RCS,SCCS}{,/**/*}",
|
||||
"!**/node_modules/**/*.{conf,png,pc,coffee,txt,spec.js,ts,js.flow,html,def,jst,xml,ico,in,ac,sln,dsp,dsw,cmd,vcproj,vcxproj,vcxproj.filters,pdb,exp,obj,lib,map,md,sh,gypi,gyp,h,cpp,yml,log,tlog,Makefile,mk,c,cc,rc,xcodeproj,xcconfig,d.ts,yaml,hpp}",
|
||||
"!**/node_modules/**/node-v*-x64{,/**/*}",
|
||||
"!**/node_modules/bluebird/js/browser{,/**/*}",
|
||||
"!**/node_modules/bluebird/js/browser{,/**/*}",
|
||||
"!**/node_modules/source-map/dist{,/**/*}",
|
||||
"!**/node_modules/lodash/fp{,/**/*}",
|
||||
"!**/node_modules/async/!(dist|package.json)",
|
||||
"!**/node_modules/async/internal{,/**/*}",
|
||||
"!**/node_modules/ajv/dist{,/**/*}",
|
||||
"!**/node_modules/ajv/scripts{,/**/*}",
|
||||
"!**/node_modules/node-pre-gyp/!(lib|package.json)",
|
||||
"!**/node_modules/node-pre-gyp/lib/!(util|pre-binding.js|node-pre-gyp.js)",
|
||||
"!**/node_modules/node-pre-gyp/lib/util/!(versioning.js|abi_crosswalk.json)",
|
||||
"!**/node_modules/source-map-support/browser-source-map-support.js",
|
||||
"!**/node_modules/json-schema/!(package.json|lib)"
|
||||
]
|
||||
```
|
||||
|
||||
## 使用本地 Node 模块的项目的构建设置
|
||||
|
||||
对于使用 **Native Node Module**的项目,请将以下脚本添加到您的 `package.json`: 安装依赖项时,`electron-builder` 会处理任何需要重建的模块。
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
order: 1
|
||||
---
|
||||
|
||||
# 入门
|
||||
|
||||
## 克隆项目
|
||||
|
||||
### 方法 1: `npm init` (推荐)
|
||||
|
||||
只需使用 npm 命令,就能轻松克隆一个版本库。
|
||||
|
||||
```shell
|
||||
$ npm init vutron
|
||||
```
|
||||
|
||||
上述方法不会为项目创建不必要的文档和`.github`相关文件。
|
||||
|
||||
### 方法 2: 使用此模板
|
||||
|
||||
点击 **[使用此模板](https://github.com/jooy2/vutron/generate)**,立即创建自己的项目。
|
||||
|
||||
此方法可立即在 GitHub 上创建一个仓库,但在使用之前,您需要在本地克隆该项目。
|
||||
|
||||
### 方法 3: 克隆该版本库
|
||||
|
||||
使用以下命令克隆该 repo。此方法适用于直接向 Vutron 代码库投稿。
|
||||
|
||||
```shell
|
||||
$ git clone https://github.com/jooy2/vutron <PROJECT_NAME>
|
||||
```
|
||||
|
||||
## 安装
|
||||
|
||||
克隆项目后,在终端运行以下命令:
|
||||
|
||||
```shell
|
||||
# via npm
|
||||
$ npm i
|
||||
|
||||
# via yarn (https://yarnpkg.com)
|
||||
$ yarn install
|
||||
|
||||
# via pnpm (https://pnpm.io)
|
||||
$ pnpm i
|
||||
```
|
||||
|
||||
## 在开发环境中运行
|
||||
|
||||
开发环境中的应用程序通过 **[Vite](https://vitejs.dev)** 运行。
|
||||
|
||||
```shell
|
||||
$ npm run dev
|
||||
```
|
||||
|
||||
如果运行命令行命令后应用程序没有出现,您可能需要检查默认端口是否被其他应用程序使用。
|
||||
|
||||
Vite 默认使用端口 `5173`。
|
||||
@@ -0,0 +1 @@
|
||||
# 安装和构建
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
order: 5
|
||||
---
|
||||
|
||||
# 管理本地文档
|
||||
|
||||
Vutron 中的文档可以通过 VitePress 查看器在本地环境中查看。
|
||||
|
||||
此功能仅在克隆整个项目时可用。如果您使用 npm init vutron 创建项目,则不会包含 docs 文件夹。
|
||||
|
||||
## 安装
|
||||
|
||||
以下说明中的所有操作均应在"文档"文件夹中完成。
|
||||
|
||||
```shell
|
||||
$ cd docs
|
||||
```
|
||||
|
||||
使用以下命令安装相关软件包:
|
||||
|
||||
```shell
|
||||
# via npm
|
||||
$ npm i
|
||||
|
||||
# via yarn (https://yarnpkg.com)
|
||||
$ yarn install
|
||||
|
||||
# via pnpm (https://pnpm.io)
|
||||
$ pnpm i
|
||||
```
|
||||
|
||||
您可以通过以下命令运行托管文档的本地服务器。
|
||||
|
||||
```shell
|
||||
$ npm run dev
|
||||
```
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: NPM Scripts
|
||||
order: 3
|
||||
---
|
||||
|
||||
# Npm 脚本
|
||||
|
||||
> $ npm run %SCRIPT_NAME%
|
||||
|
||||
## 一般情况
|
||||
|
||||
| 脚本名称 | 说明 |
|
||||
| ----------------- | ---------------------------------------------------------- |
|
||||
| `dev` | 启动电子作为开发环境 |
|
||||
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
|
||||
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
|
||||
| `build:pre` | 通常在编译时运行的命令。此脚本无需单独运行。 |
|
||||
| `build` | 为当前操作系统打包。 |
|
||||
| `build:all` | 为整个操作系统构建指定软件包(需要跨平台构建配置) |
|
||||
| `build:dir` | `electron-builder`目录构建 |
|
||||
| `build:mac` | 为macOS构建预配置软件包 |
|
||||
| `build:linux` | 为Linux构建预配置软件包 |
|
||||
| `build:win` | 为Windows构建预配置软件包 |
|
||||
| `lint` | ESLint代码检查。它不会修改代码。 |
|
||||
| `lint:fix` | ESLint代码检查。使用自动修复功能修复代码。 |
|
||||
| `format` | 更漂亮的代码检查。它不会修改代码。 |
|
||||
| `format:fix` | 更漂亮的代码检查。使用自动修复功能修复代码。 |
|
||||
| `test` | 根据测试规范文件构建测试包并运行测试。 |
|
||||
| `test:linux` | 根据测试规范文件构建测试包并运行测试。(仅适用于linux ci) |
|
||||
|
||||
## 文档
|
||||
|
||||
仅用于为项目文档提供素材。必须从“文档”目录位置运行。
|
||||
|
||||
| Script Name | Description |
|
||||
| ----------- | ---------------------------------------------- |
|
||||
| `dev` | 启动本地文档服务器。(开发中) |
|
||||
| `build` | 构建本地文档服务器。仅用于 GitHub 页面构建器。 |
|
||||
| `serve` | 启动本地文档服务器。 |
|
||||
Reference in new issue
Block a user