@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 CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.2.48
2
+
3
+ 1. 添加 rsync 版本限制
4
+ 2. 修复触发生成 apk-shell api 变更
5
+
1
6
  # 1.2.46
2
7
 
3
8
  1. 修复拉取构建的镜像dns错误
@@ -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()
@@ -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
- if (isSync) {
429
- await devshell.shell()
430
- } else {
431
- await devshell.connectShell()
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
- if (isLinux || isMacOs) {
623
- // 检查rsync工具是否存在:提示用户
624
- const rsyncExisted = commandExists.sync("rsync")
625
- if (!rsyncExisted) {
626
- logger.error("请检查 rsync 是否安装,路径是否正确!")
627
- process.exit(1)
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
- 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
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
- process.exit(1)
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
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.2.46",
3
+ "version": "1.2.48",
4
4
  "description": "lazycat cloud developer kit",
5
+ "scripts": {
6
+ "prepublishOnly": "node check-changelog.js"
7
+ },
5
8
  "files": [
6
9
  "template",
7
10
  "scripts",