Skip to content

Commit

Permalink
🎨 Refactoring CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Jun 22, 2023
1 parent 87e91ec commit b2d0d7a
Show file tree
Hide file tree
Showing 38 changed files with 1,452 additions and 5,106 deletions.
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
src-tauri/target
node_modules
dist/**/*
!dist/twitter.css
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ In addition, double-click the title bar to switch to full-screen mode. For Mac u

![Pake](https://gw.alipayobjects.com/zos/k/zd/pake.gif)

**Pake provides a command line tool, making the flow of package customization quicker and easier. See [documentation](./bin/README_EN.md) for more information.**
**Pake provides a command line tool, making the flow of package customization quicker and easier. See [documentation](./bin/README_CN.md) for more information.**

```bash
# Install with npm
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
</kbd>
<br/><br/>

**Pake 提供了命令行工具,可以更快捷方便地一键自定义打你需要的包,详细可见 [文档](./bin/README.md)**
**Pake 提供了命令行工具,可以更快捷方便地一键自定义打你需要的包,详细可见 [文档](./bin/README_CN.md)**

```bash
# 使用 npm 进行安装
Expand Down
104 changes: 51 additions & 53 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
## 安装
## Installation

请确保 Node 版本>=16 如 16.8,不要使用 sudo 进行安装,假如 npm 报没有权限可以参考 [How to fix npm throwing error without sudo](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo)
Ensure that your Node.js version is 16.0 or higher (e.g., 16.8). Avoid using `sudo` for the installation. If you encounter permission issues with npm, refer to [How to fix npm throwing error without sudo](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo).

```bash
npm install -g pake-cli
npm install pake-cli -g
```

## Windows/Linux 注意点
## Considerations for Windows & Linux Users

- **十分重要** 查看 Tauri 提供的[依赖指南](https://tauri.app/v1/guides/getting-started/prerequisites)
- 对于 windows(至少安装了`Win10 SDK(10.0.19041.0)` `Visual Studio build tool 2022>=17.2`),还需要额外安装:
- **CRITICAL**: Consult [Tauri prerequisites](https://tauri.app/v1/guides/getting-started/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:

1. Microsoft Visual C++ 2015-2022 Redistributable (x64)
2. Microsoft Visual C++ 2015-2022 Redistributable (x86)
3. Microsoft Visual C++ 2012 Redistributable (x86)(可选)
4. Microsoft Visual C++ 2013 Redistributable (x86)(可选)
5. Microsoft Visual C++ 2008 Redistributable (x86)(可选)
3. Microsoft Visual C++ 2012 Redistributable (x86) (optional)
4. Microsoft Visual C++ 2013 Redistributable (x86) (optional)
5. Microsoft Visual C++ 2008 Redistributable (x86) (optional)

- 此外 Ubuntu 在开始之前可以运行如下命令,安装前期所需依赖。
- For Ubuntu users, execute the following commands to install the required libraries before compiling:

```bash
sudo apt install libdbus-1-dev \
Expand All @@ -35,164 +35,162 @@ npm install -g pake-cli
gnome-video-effects-extra
```

## 用法
## Usage

```bash
pake url [options]
```

打包完成后的应用程序默认为当前工作目录,首次打包由于需配置好环境,需要一些时间,请耐心等待即可。
The packaged application will be located in the current working directory by default. The first packaging might take some time due to environment configuration. Please be patient.

> **Note**:
> 打包需要用 `Rust` 环境,如果没有 `Rust`,会提示确认安装。如遇安装失败或超时,可[自行安装](https://www.rust-lang.org/tools/install)
> **Note**: Packaging requires the Rust environment. If Rust is not installed, you will be prompted for installation confirmation. In case of installation failure or timeout, you can [install it manually](https://www.rust-lang.org/tools/install).
### url

url 为你需要打包的网页链接 🔗 或者本地 html 文件,必须提供。
The URL is the link to the web page you want to package or the path to a local HTML file. This is mandatory.

### [options]

提供了一些特定的选项,打包时可以传递对应参数达到定制化的效果。
Various options are available for customization. You can pass corresponding arguments during packaging to achieve the desired configuration.

#### [name]

应用名称,如输入时未指定,会提示你输入,尽量使用英语。
Specify the application name. If not provided, you will be prompted to enter it. It is recommended to use English.

```shell
--name <value>
# 或者
# or
-n <value>
```

#### [icon]

应用 icon,支持本地/远程文件,默认为 Pake 自带图标,定制的可以去 [icon-icons](https://icon-icons.com) [macOSicons](https://macosicons.com/#/) 搜索下载。
Specify the application icon. Supports both local and remote files. By default, it uses the Pake brand icon. For custom icons, visit [icon icons](https://icon-icons.com) or [macOSicons](https://macosicons.com/#/).

- MacOS 下必须为 `.icns`
- Windows 下必须为 `.ico`
- Linux 下必须为 `.png`
- For macOS, use `.icns` format.
- For Windows, use `.ico` format.
- For Linux, use `.png` format.

```shell
--icon <path>
# 或者
-i <path>
```

#### [height]

打包后的应用窗口高度,默认 `780px`
Set the height of the application window. Default is `780px`.

```shell
--height <number>
# 或者
-h <number>
```

#### [width]

打包后的应用窗口宽度,默认 `1200px`
Set the width of the application window. Default is `1200px`.

```shell
--width <number>
# 或者
-w <number>
```

#### [transparent]

是否开启沉浸式头部,默认为 `false` 不开启,输入下面的命令则开启沉浸式,推荐 MacOS 用户开启。
Enable or disable immersive header. Default is `false`. Use the following command to enable this feature.

```
```shell
--transparent
```

#### [resize]
#### [fullscreen]

是否可以拖动大小,默认为 `true` 可拖动,输入下面的命令则不能对窗口大小进行拉伸。
Determine whether the application launches in full screen. Default is `false`. Use the following command to enable full screen.

```shell
--no-resizable
--fullscreen
```

#### [fullscreen]
#### [resize]

打开应用后是否开启全屏,默认为 `false`,输入下面的命令则会自动全屏。
Determine whether the window is resizable. Default is `true`. Use the following command to disable window resizing.

```shell
--fullscreen
--no-resizable
```

#### [multi-arch]

打包结果同时支持英特尔和 m1 芯片,仅适用于 MacOS,默认为 `false`
Package the application to support both Intel and M1 chips, exclusively for macOS. Default is `false`.

##### 准备工作
##### Prerequisites

- 注意:开启该选项后,需要用 rust 官网的 rustup 安装 rust,不支持 brew 安装。
- 对于 intel 芯片用户,需要安装 arm64 跨平台包,使安装包支持 m1 芯片,使用下面命令安装。
- Note: After enabling this option, Rust must be installed using rustup from the official Rust website. Installation via brew is not supported.
- For Intel chip users, install the arm64 cross-platform package to support M1 chips using the following command:

```shell
rustup target add aarch64-apple-darwin
```

- 对于 M1 芯片用户,需要安装 x86 跨平台包,使安装包支持 interl 芯片,使用下面的命令安装。
- For M1 chip users, install the x86 cross-platform package to support Intel chips using the following command:

```shell
rustup target add x86_64-apple-darwin
```

##### 使用方法
##### Usage

```shell
--multi-arch
# 或者
-m
```

#### [targets]

选择输出的包格式,支持 deb/appimage/all,如果选择 all,则同时打包 debappimage,该选项仅支持 Linux,默认为`all`
Select the output package format for Linux. Options include `deb`, `appimage`, or `all`. If `all` is selected, both `deb` and `appimage` will be packaged. Default is `all`.

```shell
--targets xxx
--targets <format>
```

#### [user-agent]

自定义浏览器请求头, 默认为空。
Customize the browser user agent. Default is empty.

```shell
--user-agent <value>
```

#### [show-menu]

显示菜单栏, 默认不显示,输入下面的命令则会显示,推荐MacOS用户开启。
Display the menu bar. Default is not to display. Use the following command to enable the menu bar. Recommended for macOS users.

```shell
--show-menu
```

#### [show-system-tray]

显示通知栏托盘, 默认不显示,输入下面的命令则会显示。
Display the system tray. Default is not to display. Use the following command to enable the system tray.

```shell
--show-system-tray
```

#### [system-tray-icon]

通知栏托盘图标,仅当显示通知栏托盘时有效, 图标必须为.ico或者.png格式的,32x32~256x256像素的图片。
Specify the system tray icon. This is only effective when the system tray is enabled. The icon must be in `.ico` or `.png` format and should be an image with dimensions ranging from 32x32 to 256x256 pixels.

```shell
--system-tray-icon <value>
--system-tray-icon <path>
```

#### [copy-iter-file]

递归拷贝,当url为本地文件路径时候,若开启该选项,则将url路径文件所在文件夹以及所有子文件都拷贝到pake静态文件夹,默认不开启
Enable recursive copying. When the URL is a local file path, enabling this option will copy the folder containing the file specified in the URL, as well as all sub-files, to the Pake static folder. This is disabled by default.

```shell
--copy-iter-file
```

## 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.

Loading

0 comments on commit b2d0d7a

Please sign in to comment.