pake-cli 2.0.0-alpha8 → 2.0.0-alpha9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -2051,36 +2051,34 @@ function isChinaDomain(domain) {
|
|
|
2051
2051
|
}
|
|
2052
2052
|
function isChinaIP(ip, domain) {
|
|
2053
2053
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
resolve(false);
|
|
2066
|
-
});
|
|
2067
|
-
});
|
|
2054
|
+
try {
|
|
2055
|
+
const delay = yield ping(ip);
|
|
2056
|
+
logger.info(`${domain} latency is ${delay} ms`);
|
|
2057
|
+
// 判断延迟是否超过500ms
|
|
2058
|
+
return delay > 500;
|
|
2059
|
+
}
|
|
2060
|
+
catch (error) {
|
|
2061
|
+
// 命令执行出错,返回false
|
|
2062
|
+
logger.info(`ping ${domain} failed!, is not in China!`);
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2068
2065
|
});
|
|
2069
2066
|
}
|
|
2070
2067
|
|
|
2071
|
-
const is_china = isChinaDomain("sh.rustup.rs");
|
|
2072
|
-
let RustInstallScriptFocMac = "";
|
|
2073
|
-
if (is_china) {
|
|
2074
|
-
RustInstallScriptFocMac =
|
|
2075
|
-
'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh';
|
|
2076
|
-
}
|
|
2077
|
-
else {
|
|
2078
|
-
RustInstallScriptFocMac =
|
|
2079
|
-
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
2080
|
-
}
|
|
2081
|
-
const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup';
|
|
2082
2068
|
function installRust() {
|
|
2083
2069
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2070
|
+
const is_china = yield isChinaDomain("sh.rustup.rs");
|
|
2071
|
+
let RustInstallScriptFocMac = "";
|
|
2072
|
+
if (is_china) {
|
|
2073
|
+
logger.info("it's in China, use rust cn mirror to install rust");
|
|
2074
|
+
RustInstallScriptFocMac =
|
|
2075
|
+
'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh';
|
|
2076
|
+
}
|
|
2077
|
+
else {
|
|
2078
|
+
RustInstallScriptFocMac =
|
|
2079
|
+
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
|
|
2080
|
+
}
|
|
2081
|
+
const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup';
|
|
2084
2082
|
const spinner = ora('Downloading Rust').start();
|
|
2085
2083
|
try {
|
|
2086
2084
|
yield shellExec(IS_WIN ? RustInstallScriptForWin : RustInstallScriptFocMac);
|
|
@@ -2313,11 +2311,15 @@ class MacBuilder {
|
|
|
2313
2311
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2314
2312
|
let dmgName;
|
|
2315
2313
|
if (options.multiArch) {
|
|
2316
|
-
const isChina = isChinaDomain("www.npmjs.com");
|
|
2314
|
+
const isChina = yield isChinaDomain("www.npmjs.com");
|
|
2317
2315
|
if (isChina) {
|
|
2318
|
-
|
|
2316
|
+
logger.info("it's in China, use npm/rust cn mirror");
|
|
2319
2317
|
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2320
|
-
const
|
|
2318
|
+
const e1 = fs$1.access(rust_project_dir);
|
|
2319
|
+
if (e1) {
|
|
2320
|
+
yield fs$1.mkdir(rust_project_dir, { recursive: true });
|
|
2321
|
+
}
|
|
2322
|
+
const project_cn_conf = path.join(npmDirectory, "src-tauri", "cn_config.bak");
|
|
2321
2323
|
const project_conf = path.join(rust_project_dir, "config");
|
|
2322
2324
|
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2323
2325
|
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build:mac`);
|
|
@@ -2392,11 +2394,15 @@ class WinBuilder {
|
|
|
2392
2394
|
logger.debug('PakeAppOptions', options);
|
|
2393
2395
|
const { name } = options;
|
|
2394
2396
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2395
|
-
const isChina = isChinaDomain("www.npmjs.com");
|
|
2397
|
+
const isChina = yield isChinaDomain("www.npmjs.com");
|
|
2396
2398
|
if (isChina) {
|
|
2397
|
-
|
|
2399
|
+
logger.info("it's in China, use npm/rust cn mirror");
|
|
2398
2400
|
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2399
|
-
const
|
|
2401
|
+
const e1 = fs$1.access(rust_project_dir);
|
|
2402
|
+
if (e1) {
|
|
2403
|
+
yield fs$1.mkdir(rust_project_dir, { recursive: true });
|
|
2404
|
+
}
|
|
2405
|
+
const project_cn_conf = path.join(npmDirectory, "src-tauri", "cn_config.bak");
|
|
2400
2406
|
const project_conf = path.join(rust_project_dir, "config");
|
|
2401
2407
|
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2402
2408
|
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
@@ -2448,11 +2454,15 @@ class LinuxBuilder {
|
|
|
2448
2454
|
logger.debug('PakeAppOptions', options);
|
|
2449
2455
|
const { name } = options;
|
|
2450
2456
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2451
|
-
const isChina = isChinaDomain("www.npmjs.com");
|
|
2457
|
+
const isChina = yield isChinaDomain("www.npmjs.com");
|
|
2452
2458
|
if (isChina) {
|
|
2453
|
-
|
|
2459
|
+
logger.info("it's in China, use npm/rust cn mirror");
|
|
2454
2460
|
const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo");
|
|
2455
|
-
const
|
|
2461
|
+
const e1 = fs$1.access(rust_project_dir);
|
|
2462
|
+
if (e1) {
|
|
2463
|
+
yield fs$1.mkdir(rust_project_dir, { recursive: true });
|
|
2464
|
+
}
|
|
2465
|
+
const project_cn_conf = path.join(npmDirectory, "src-tauri", "cn_config.bak");
|
|
2456
2466
|
const project_conf = path.join(rust_project_dir, "config");
|
|
2457
2467
|
fs$1.copyFile(project_cn_conf, project_conf);
|
|
2458
2468
|
yield shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com && npm run build`);
|
|
@@ -2508,7 +2518,7 @@ class BuilderFactory {
|
|
|
2508
2518
|
}
|
|
2509
2519
|
|
|
2510
2520
|
var name = "pake-cli";
|
|
2511
|
-
var version = "2.0.0-
|
|
2521
|
+
var version = "2.0.0-alpha9";
|
|
2512
2522
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
|
|
2513
2523
|
var engines = {
|
|
2514
2524
|
node: ">=16.0.0"
|
package/package.json
CHANGED
|
File without changes
|