docs: 补充 pake-cli doc

This commit is contained in:
jeasonnow
2023-08-10 18:25:08 +08:00
parent 81f99322b7
commit aace53e513
2 changed files with 86 additions and 0 deletions

40
bin/README.md vendored
View File

@@ -39,6 +39,29 @@ npm install pake-cli -g
## Usage
### Development
The `DEFAULT_DEV_PAKE_OPTIONS` configuration in `bin/defaults.ts` can be modified at development time to match the `pake-cli` configuration description.
```typescript
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & {url: string} = {
...DEFAULT_PAKE_OPTIONS,
url: 'https://weread.qq.com',
name: 'Weread',
}
```
then
```bash
yarn cli:dev
```
The script will reads the above configuration and packages the specified `app` using `watch` mode, and changes to the `pake-cli` code and `pake` are hot updated in real time.
### CLI Usage
```bash
pake [url] [options]
```
@@ -180,6 +203,23 @@ Enable recursive copying. When the URL is a local file path, enabling this optio
--iter-copy-file
```
#### [inject]
Using `inject`, you can inject local absolute and relative path `css` and `js` files into the page you specify the `url` to customize it. For example, an adblock script that can be applied to any web page, or a `css` that optimizes the `UI` of a page, you can write it once to customize it. would only need to write the `app` once to generalize it to any other page.
```shell
--inject ./tools/style.css,./tools/hotkey.js
```
#### [safe-domain]
This secure domain is a domain other than your currently configured `url` to which you may be redirected or jumped to, and only in domains that have been configured as secure can you use `tauri` to expose `api` to browsers to ensure that pake's built-in enhancements work correctly. Only in a domain that has been configured as secure can you use the `tauri` to expose the `api` to the browser, ensuring that `pake's` built-in enhancements work correctly.
PS: Secure domains do not need to carry protocols.
```shell
--safe-domain weread.qq.com,google.com
```
## Conclusion
After completing the above steps, your application should be successfully packaged. Please note that the packaging process may take some time depending on your system configuration and network conditions. Be patient, and once the packaging is complete, you can find the application installer in the specified directory.

46
bin/README_CN.md vendored
View File

@@ -39,6 +39,28 @@ npm install pake-cli -g
## 使用方法
### 开发
开发时可以修改 `bin/defaults.ts` 中 `DEFAULT_DEV_PAKE_OPTIONS` 配置,配置项和 `pake-cli` 配置说明保持一致
```typescript
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & {url: string} = {
...DEFAULT_PAKE_OPTIONS,
url: 'https://weread.qq.com',
name: 'Weread',
}
```
之后运行
```bash
yarn cli:dev
```
脚本会读取上述配置并使用 `watch` 模式打包指定的 `app`,对 `pake-cli` 代码和 `pake` 的修改都会实时热更新。
### 使用 CLI
```bash
pake [url] [options]
```
@@ -184,6 +206,30 @@ Linux默认为 `all`。
--iter-copy-file
```
#### [inject]
使用 `inject` 可以通过本地的绝对、相对路径的 `css` `js` 文件注入到你所指定 `url` 的页面中,从而为
其做定制化改造。举个例子:一段可以通用到任何网页的广告屏蔽脚本,或者是优化页面 `UI` 展的 `css`,你
只需要书写一次可以将其通用到任何其他网页打包的 `app`。
```shell
--inject ./tools/style.css,./tools/hotkey.js
```
#### [safe-domain]
这个安全域名是除你当前配置的 `url` 之外可能会出现重定向或跳转到的其他域名,只有在已配置为安全的域名中,
才能够使用 `tauri` 暴露到浏览器的 `api` ,保证 `pake` 内置增强功能的正确运行。
PS: 安全域名不需要携带协议。
```shell
--safe-domain weread.qq.com,google.com
```
## 结语
完成上述步骤后,您的应用程序应该已经成功打包。请注意,根据您的系统配置和网络状况,打包过程可能需要一些时间。请耐心等待,一旦打包完成,您就可以在指定的目录中找到应用程序安装包。