@lazycatcloud/lzc-cli 1.2.46 → 1.2.48
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/changelog.md +5 -0
- package/lib/app/apkshell.js +1 -1
- package/lib/app/index.js +4 -1
- package/lib/app/lpk_devshell.js +9 -9
- package/lib/utils.js +24 -26
- package/package.json +4 -1
package/changelog.md
CHANGED
package/lib/app/apkshell.js
CHANGED
|
@@ -16,7 +16,7 @@ export async function triggerApk(id, name, iconPath) {
|
|
|
16
16
|
form.append("app_icon", new Blob([fs.readFileSync(iconPath)]))
|
|
17
17
|
}
|
|
18
18
|
const resp = await api.post(
|
|
19
|
-
"https://appstore.lazycat.cloud/api/trigger_latest_for_app",
|
|
19
|
+
"https://appstore.api.lazycat.cloud/api/trigger_latest_for_app",
|
|
20
20
|
form,
|
|
21
21
|
{ timeout: 5000 }
|
|
22
22
|
)
|
package/lib/app/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { LpkBuild } from "./lpk_build.js"
|
|
|
4
4
|
import { AppDevShell } from "./lpk_devshell.js"
|
|
5
5
|
import { LpkInstaller, installConfig } from "./lpk_installer.js"
|
|
6
6
|
import logger from "loglevel"
|
|
7
|
-
import { sleep } from "../utils.js"
|
|
7
|
+
import { sleep, checkRsync } from "../utils.js"
|
|
8
8
|
import { DebugBridge } from "./lpk_debug_bridge.js"
|
|
9
9
|
import shellApi from "../shellapi.js"
|
|
10
10
|
import { generate } from "./lpk_create_generator.js"
|
|
@@ -84,6 +84,9 @@ export function lpkProjectCommand(program) {
|
|
|
84
84
|
},
|
|
85
85
|
handler: async ({ context, force, config, contentdir, apk }) => {
|
|
86
86
|
await shellApi.init()
|
|
87
|
+
// 检测 rsync 满足
|
|
88
|
+
await checkRsync()
|
|
89
|
+
|
|
87
90
|
installConfig.apk = apk == "y"
|
|
88
91
|
const cwd = context ? path.resolve(context) : process.cwd()
|
|
89
92
|
const lpkBuild = await new LpkBuild(cwd, config).init()
|
package/lib/app/lpk_devshell.js
CHANGED
|
@@ -21,8 +21,7 @@ import {
|
|
|
21
21
|
resolveDomain,
|
|
22
22
|
isWindows,
|
|
23
23
|
isMacOs,
|
|
24
|
-
isLinux
|
|
25
|
-
checkRsync
|
|
24
|
+
isLinux
|
|
26
25
|
} from "../utils.js"
|
|
27
26
|
import os from "node:os"
|
|
28
27
|
import chokidar from "chokidar"
|
|
@@ -425,10 +424,14 @@ export class AppDevShell {
|
|
|
425
424
|
}
|
|
426
425
|
|
|
427
426
|
const devshell = new DevShell(pkgId, this.isUserApp)
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
427
|
+
try {
|
|
428
|
+
if (isSync) {
|
|
429
|
+
await devshell.shell()
|
|
430
|
+
} else {
|
|
431
|
+
await devshell.connectShell()
|
|
432
|
+
}
|
|
433
|
+
} catch (e) {
|
|
434
|
+
logger.error(`devshell 错误: ${e}`)
|
|
432
435
|
}
|
|
433
436
|
logger.debug("exit shell")
|
|
434
437
|
// TODO: shell 在正常情况下,按 Ctrl-D 就会退出,回到原来的本地的 shell ,但
|
|
@@ -444,8 +447,6 @@ class DevShell {
|
|
|
444
447
|
}
|
|
445
448
|
|
|
446
449
|
async syncProject(appId) {
|
|
447
|
-
checkRsync()
|
|
448
|
-
|
|
449
450
|
const resolvedIp = await resolveDomain(
|
|
450
451
|
`dev.${shellApi.boxname}.heiyu.space`
|
|
451
452
|
)
|
|
@@ -555,7 +556,6 @@ class DevShell {
|
|
|
555
556
|
await this.syncProject(this.appId)
|
|
556
557
|
})
|
|
557
558
|
} catch (e) {
|
|
558
|
-
console.log(e)
|
|
559
559
|
return Promise.reject(e)
|
|
560
560
|
}
|
|
561
561
|
}
|
package/lib/utils.js
CHANGED
|
@@ -619,34 +619,32 @@ export function findSshPublicKey() {
|
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
export function checkRsync() {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
622
|
+
return new Promise((resolve, reject) => {
|
|
623
|
+
if (isLinux || isMacOs) {
|
|
624
|
+
// 检查rsync工具是否存在:提示用户
|
|
625
|
+
const rsyncExisted = commandExists.sync("rsync")
|
|
626
|
+
if (!rsyncExisted) {
|
|
627
|
+
reject("请检查 rsync 是否安装,路径是否正确!")
|
|
628
|
+
}
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
)
|
|
640
|
-
if (!versionMatch || compareVersions("3.2.0", versionMatch[1]) < 0) {
|
|
641
|
-
logger.error(
|
|
642
|
-
`当前rsync版本为:${versionMatch[1]}, 要求rsync版本为: 3.2.0+`
|
|
630
|
+
const check = spawn.sync("rsync", ["--version"], {
|
|
631
|
+
shell: true,
|
|
632
|
+
encoding: "utf-8",
|
|
633
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
634
|
+
})
|
|
635
|
+
logger.debug(`执行命令 rsync --version`)
|
|
636
|
+
if (check.status == 0) {
|
|
637
|
+
const versionMatch = check.stdout.match(
|
|
638
|
+
/rsync\s+version\s+(\d+\.\d+\.\d+)/i
|
|
643
639
|
)
|
|
644
|
-
|
|
640
|
+
if (!versionMatch || compareVersions("3.2.0", versionMatch[1]) < 0) {
|
|
641
|
+
reject(`当前rsync版本为:${versionMatch[1]}, 要求rsync版本为: 3.2.0+`)
|
|
642
|
+
}
|
|
643
|
+
logger.debug(`当前rsync版本为:${versionMatch[1]}`)
|
|
644
|
+
} else {
|
|
645
|
+
reject("请检查 rsync 安装是否正确,指定 rsync --version 错误")
|
|
645
646
|
}
|
|
646
|
-
logger.debug(`当前rsync版本为:${versionMatch[1]}`)
|
|
647
|
-
} else {
|
|
648
|
-
logger.error("请检查 rsync 安装是否正确,指定 rsync --version 错误")
|
|
649
|
-
process.exit(1)
|
|
650
647
|
}
|
|
651
|
-
|
|
648
|
+
resolve()
|
|
649
|
+
})
|
|
652
650
|
}
|
package/package.json
CHANGED