Support two-word naming

This commit is contained in:
Tw93
2025-08-05 15:37:30 +08:00
parent d8f1db214c
commit 2af3805b93
5 changed files with 26 additions and 6 deletions

View File

@@ -49,6 +49,9 @@ npm install -g pake-cli
# Package a webpage
pake https://example.com --name MyApp --width 1200 --height 800
# Also supports names with spaces (cross-platform compatible)
# pake https://translate.google.com --name "Google Translate" --hide-title-bar
# Development with custom options
# Modify DEFAULT_DEV_PAKE_OPTIONS in bin/defaults.ts
npm run cli:dev

9
bin/README.md vendored
View File

@@ -62,8 +62,17 @@ Various options are available for customization. You can pass corresponding argu
Specify the application name. If not provided, you will be prompted to enter it. It is recommended to use English.
**Note**: Also supports multiple words with automatic platform-specific handling:
- **Windows/macOS**: Preserves spaces and case (e.g., `"Google Translate"`)
- **Linux**: Converts to lowercase with hyphens (e.g., `"google-translate"`)
```shell
--name <string>
--name MyApp
# Multiple words (if needed):
--name "Google Translate"
```
#### [icon]

11
bin/README_CN.md vendored
View File

@@ -60,10 +60,19 @@ pake [url] [options]
#### [name]
指定应用程序的名称,如果在输入时未指定,系统会提示您输入,建议使用单个英文名称,不要出现下划线或者中文
指定应用程序的名称,如果未指定,系统会提示您输入,建议使用英文单词
**注意**: 也支持多个单词,会自动处理不同平台的命名规范:
- **Windows/macOS**: 保持空格和大小写(如 `"Google Translate"`
- **Linux**: 转换为小写并用连字符连接(如 `"google-translate"`
```shell
--name <string>
--name MyApp
# 多个单词(如需要):
--name "Google Translate"
```
#### [icon]

7
dist/cli.js vendored
View File

@@ -134,7 +134,8 @@ var windows = [
always_on_top: false,
dark_mode: false,
activation_shortcut: "",
disabled_web_shortcuts: false
disabled_web_shortcuts: false,
hide_on_close: false
}
];
var user_agent = {
@@ -147,7 +148,6 @@ var system_tray = {
linux: true,
windows: true
};
var hide_on_close = true;
var system_tray_path = "icons/icon.png";
var inject = [
];
@@ -156,7 +156,6 @@ var pakeConf = {
windows: windows,
user_agent: user_agent,
system_tray: system_tray,
hide_on_close: hide_on_close,
system_tray_path: system_tray_path,
inject: inject,
proxy_url: proxy_url
@@ -445,6 +444,7 @@ async function mergeConfig(url, options, tauriConf) {
always_on_top: alwaysOnTop,
dark_mode: darkMode,
disabled_web_shortcuts: disabledWebShortcuts,
hide_on_close: hideOnClose,
};
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
tauriConf.productName = name;
@@ -490,7 +490,6 @@ async function mergeConfig(url, options, tauriConf) {
tauriConf.pake.user_agent[currentPlatform] = userAgent;
}
tauriConf.pake.system_tray[currentPlatform] = showSystemTray;
tauriConf.pake.hide_on_close = hideOnClose;
// Processing targets are currently only open to Linux.
if (platform === 'linux') {
delete tauriConf.bundle.linux.deb.files;

View File

@@ -12,7 +12,7 @@
"dark_mode": false,
"activation_shortcut": "",
"disabled_web_shortcuts": false,
"hide_on_close": false
"hide_on_close": true
}
],
"user_agent": {