📝 CLI documentation update
This commit is contained in:
49
bin/README.md
vendored
49
bin/README.md
vendored
@@ -8,7 +8,8 @@ Ensure that your Node.js version is 18.0 or higher (e.g., 18.20.2). Avoid using
|
||||
npm install pake-cli -g
|
||||
```
|
||||
|
||||
## Considerations for Windows & Linux Users
|
||||
<details>
|
||||
<summary><strong>Considerations for Windows & Linux Users</strong></summary>
|
||||
|
||||
- **CRITICAL**: Consult [Tauri prerequisites](https://tauri.app/start/prerequisites/) before proceeding.
|
||||
- For Windows users (ensure that `Win10 SDK (10.0.19041.0)` and `Visual Studio build tool 2022 (>=17.2)` are installed), additional installations are required:
|
||||
@@ -37,29 +38,9 @@ npm install pake-cli -g
|
||||
gnome-video-effects-extra
|
||||
```
|
||||
|
||||
## Usage
|
||||
</details>
|
||||
|
||||
### 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 read 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
|
||||
## CLI Usage
|
||||
|
||||
```bash
|
||||
pake [url] [options]
|
||||
@@ -259,10 +240,30 @@ The typed package has dev-tools for debugging, in addition to outputting more lo
|
||||
--debug
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
### Wait a moment
|
||||
|
||||
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.
|
||||
|
||||
## 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
|
||||
npm run cli:dev
|
||||
```
|
||||
|
||||
The script will read 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.
|
||||
|
||||
## Docker
|
||||
|
||||
```shell
|
||||
|
||||
51
bin/README_CN.md
vendored
51
bin/README_CN.md
vendored
@@ -8,7 +8,8 @@
|
||||
npm install pake-cli -g
|
||||
```
|
||||
|
||||
## Windows/Linux 注意事项
|
||||
<details>
|
||||
<summary><strong>Windows/Linux 注意事项</strong></summary>
|
||||
|
||||
- **非常重要**:请参阅 Tauri 的 [依赖项指南](https://tauri.app/start/prerequisites/)。
|
||||
- 对于 Windows 用户,请确保至少安装了 `Win10 SDK(10.0.19041.0)` 和 `Visual Studio Build Tools 2022(版本 17.2 或更高)`,此外还需要安装以下组件:
|
||||
@@ -37,29 +38,9 @@ npm install pake-cli -g
|
||||
gnome-video-effects-extra
|
||||
```
|
||||
|
||||
## 使用方法
|
||||
</details>
|
||||
|
||||
### 开发
|
||||
|
||||
开发时可以修改 `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]
|
||||
@@ -266,11 +247,31 @@ Linux,默认为 `all`。
|
||||
--debug
|
||||
```
|
||||
|
||||
## 结语
|
||||
### 稍等片刻
|
||||
|
||||
完成上述步骤后,您的应用程序应该已经成功打包。请注意,根据您的系统配置和网络状况,打包过程可能需要一些时间。请耐心等待,一旦打包完成,您就可以在指定的目录中找到应用程序安装包。
|
||||
|
||||
## Docker
|
||||
## 开发调试
|
||||
|
||||
开发时可以修改 `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
|
||||
npm run cli:dev
|
||||
```
|
||||
|
||||
脚本会读取上述配置并使用 `watch` 模式打包指定的 `app`,对 `pake-cli` 代码和 `pake` 的修改都会实时热更新。
|
||||
|
||||
## Docker 使用
|
||||
|
||||
```shell
|
||||
# 在Linux上,您可以通过 Docker 运行 Pake CLI。
|
||||
|
||||
13
bin/helpers/merge.ts
vendored
13
bin/helpers/merge.ts
vendored
@@ -47,7 +47,8 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
|
||||
tauriConf.productName = name;
|
||||
tauriConf.identifier = identifier;
|
||||
if (platform == "win32") {
|
||||
|
||||
if (platform == 'win32') {
|
||||
tauriConf.bundle.windows.wix.language[0] = installerLanguage;
|
||||
}
|
||||
|
||||
@@ -73,9 +74,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
// ignore it, because about_pake.html have be erased.
|
||||
// const filesToCopyBack = ['cli.js', 'about_pake.html'];
|
||||
const filesToCopyBack = ['cli.js'];
|
||||
await Promise.all(
|
||||
filesToCopyBack.map(file => fsExtra.copy(path.join(distBakDir, file), path.join(distDir, file))),
|
||||
);
|
||||
await Promise.all(filesToCopyBack.map(file => fsExtra.copy(path.join(distBakDir, file), path.join(distDir, file))));
|
||||
}
|
||||
|
||||
tauriConf.pake.windows[0].url = fileName;
|
||||
@@ -182,6 +181,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
delete tauriConf.app.trayIcon;
|
||||
|
||||
const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`);
|
||||
|
||||
// inject js or css files
|
||||
if (inject?.length > 0) {
|
||||
if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) {
|
||||
@@ -195,13 +195,15 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
tauriConf.pake.inject = [];
|
||||
await fsExtra.writeFile(injectFilePath, '');
|
||||
}
|
||||
tauriConf.pake.proxy_url = proxyUrl || "";
|
||||
tauriConf.pake.proxy_url = proxyUrl || '';
|
||||
|
||||
// Save config file.
|
||||
const platformConfigPaths: PlatformMap = {
|
||||
win32: 'tauri.windows.conf.json',
|
||||
darwin: 'tauri.macos.conf.json',
|
||||
linux: 'tauri.linux.conf.json',
|
||||
};
|
||||
|
||||
const configPath = path.join(tauriConfigDirectory, platformConfigPaths[platform]);
|
||||
|
||||
const bundleConf = { bundle: tauriConf.bundle };
|
||||
@@ -212,6 +214,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
|
||||
let tauriConf2 = JSON.parse(JSON.stringify(tauriConf));
|
||||
delete tauriConf2.pake;
|
||||
|
||||
// delete tauriConf2.bundle;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
tauriConf2.bundle = bundleConf.bundle;
|
||||
|
||||
Reference in New Issue
Block a user