🎨 Modify iterCopyFile to useLocalFile

This commit is contained in:
Tw93
2024-05-09 22:03:09 +08:00
parent 99c8167b55
commit 85b077abd3
7 changed files with 11 additions and 10 deletions

4
bin/README.md vendored
View File

@@ -211,12 +211,12 @@ Specify the system tray icon. This is only effective when the system tray is ena
--system-tray-icon <path> --system-tray-icon <path>
``` ```
#### [iter-copy-file] #### [use-local-file]
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. 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 ```shell
--iter-copy-file --use-local-file
``` ```
#### [inject] #### [inject]

4
bin/README_CN.md vendored
View File

@@ -212,14 +212,14 @@ Linux默认为 `all`。
--system-tray-icon <path> --system-tray-icon <path>
``` ```
#### [iter-copy-file] #### [use-local-file]
当 `url` 为本地文件路径时,如果启用此选项,则会递归地将 `url` 路径文件所在的文件夹及其所有子文件复 当 `url` 为本地文件路径时,如果启用此选项,则会递归地将 `url` 路径文件所在的文件夹及其所有子文件复
制到 Pake 的静态文件夹。默认不启用。 制到 Pake 的静态文件夹。默认不启用。
```shell ```shell
--iter-copy-file --use-local-file
``` ```
#### [inject] #### [inject]

3
bin/cli.ts vendored
View File

@@ -29,17 +29,18 @@ program
.option('--icon <string>', 'Application icon', DEFAULT.icon) .option('--icon <string>', 'Application icon', DEFAULT.icon)
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT.width) .option('--width <number>', 'Window width', validateNumberInput, DEFAULT.width)
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT.height) .option('--height <number>', 'Window height', validateNumberInput, DEFAULT.height)
.option('--use-local-file', 'Use local file packaging', DEFAULT.useLocalFile)
.option('--fullscreen', 'Start in full screen', DEFAULT.fullscreen) .option('--fullscreen', 'Start in full screen', DEFAULT.fullscreen)
.option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT.hideTitleBar) .option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT.hideTitleBar)
.option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT.activationShortcut) .option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT.activationShortcut)
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch) .option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch)
.option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT.inject) .option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT.inject)
.option('--safe-domain [domains...]', 'Domains that Require Security Configuration"', DEFAULT.safeDomain)
.option('--debug', 'Debug build and more output', DEFAULT.debug) .option('--debug', 'Debug build and more output', DEFAULT.debug)
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT.userAgent).hideHelp()) .addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT.userAgent).hideHelp())
.addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp()) .addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp())
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp()) .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp())
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT.disabledWebShortcuts).hideHelp()) .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT.disabledWebShortcuts).hideHelp())
.addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration').default(DEFAULT.safeDomain).hideHelp())
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT.showSystemTray).hideHelp()) .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT.showSystemTray).hideHelp())
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp()) .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp())
.version(packageJson.version, '-v, --version', 'Output the current version') .version(packageJson.version, '-v, --version', 'Output the current version')

2
bin/defaults.ts vendored
View File

@@ -14,7 +14,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
showSystemTray: false, showSystemTray: false,
multiArch: false, multiArch: false,
targets: 'deb', targets: 'deb',
iterCopyFile: false, useLocalFile: false,
systemTrayIcon: '', systemTrayIcon: '',
debug: false, debug: false,
inject: [], inject: [],

View File

@@ -19,7 +19,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
userAgent, userAgent,
showSystemTray, showSystemTray,
systemTrayIcon, systemTrayIcon,
iterCopyFile, useLocalFile,
identifier, identifier,
name, name,
resizable = true, resizable = true,
@@ -57,7 +57,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
const distDir = path.join(npmDirectory, 'dist'); const distDir = path.join(npmDirectory, 'dist');
const distBakDir = path.join(npmDirectory, 'dist_bak'); const distBakDir = path.join(npmDirectory, 'dist_bak');
if (!iterCopyFile) { if (!useLocalFile) {
const urlPath = path.join(distDir, fileName); const urlPath = path.join(distDir, fileName);
await fsExtra.copy(url, urlPath); await fsExtra.copy(url, urlPath);
} else { } else {

2
bin/types.ts vendored
View File

@@ -43,7 +43,7 @@ export interface PakeCliOptions {
systemTrayIcon: string; systemTrayIcon: string;
// Recursive copy, when url is a local file path, if this option is enabled, the url path file and all its subfiles will be copied to the pake static file folder, default off // Recursive copy, when url is a local file path, if this option is enabled, the url path file and all its subfiles will be copied to the pake static file folder, default off
iterCopyFile: false; useLocalFile: false;
// Multi arch, supports both Intel and M1 chips, only for Mac // Multi arch, supports both Intel and M1 chips, only for Mac
multiArch: boolean; multiArch: boolean;

View File

@@ -1,6 +1,6 @@
{ {
"name": "pake-cli", "name": "pake-cli",
"version": "2.4.0", "version": "2.5.0",
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"