fix: enhance prebuild script to support shorthand for force update #4777
This commit is contained in:
@@ -59,8 +59,9 @@ You have two options for downloading the clash binary:
|
||||
|
||||
```shell
|
||||
pnpm run prebuild
|
||||
# Use '--force' to force update to the latest version
|
||||
# pnpm run prebuild --force
|
||||
# Use '--force' or '-f' to update both the Mihomo core version
|
||||
# and the Clash Verge Rev service version to the latest available.
|
||||
pnpm run prebuild --force
|
||||
```
|
||||
|
||||
- Manually download it from the [Mihomo release](https://github.com/MetaCubeX/mihomo/releases). After downloading, rename the binary according to the [Tauri configuration](https://tauri.app/v1/api/config#bundleconfig.externalbin).
|
||||
|
||||
@@ -12,7 +12,7 @@ import { glob } from "glob";
|
||||
|
||||
const cwd = process.cwd();
|
||||
const TEMP_DIR = path.join(cwd, "node_modules/.verge");
|
||||
const FORCE = process.argv.includes("--force");
|
||||
const FORCE = process.argv.includes("--force") || process.argv.includes("-f");
|
||||
|
||||
const PLATFORM_MAP = {
|
||||
"x86_64-pc-windows-msvc": "win32",
|
||||
@@ -43,7 +43,8 @@ const ARCH_MAP = {
|
||||
|
||||
const arg1 = process.argv.slice(2)[0];
|
||||
const arg2 = process.argv.slice(2)[1];
|
||||
const target = arg1 === "--force" ? arg2 : arg1;
|
||||
let target;
|
||||
target = arg1 === "--force" || arg1 === "-f" ? arg2 : arg1;
|
||||
const { platform, arch } = target
|
||||
? { platform: PLATFORM_MAP[target], arch: ARCH_MAP[target] }
|
||||
: process;
|
||||
|
||||
Reference in New Issue
Block a user