@lazycatcloud/lzc-cli 1.2.6 → 1.2.8

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/lib/app/index.js CHANGED
@@ -31,6 +31,7 @@ export function lpkProjectCommand(program) {
31
31
  args.option("f", {
32
32
  alias: "file",
33
33
  describe: "指定构建的lzc-build.yml文件",
34
+ default: "lzc-build.yml",
34
35
  type: "string",
35
36
  });
36
37
  },
@@ -86,7 +87,7 @@ export function lpkProjectCommand(program) {
86
87
  }
87
88
  return options;
88
89
  });
89
- const app = new AppDevShell(cwd, lpkBuild, force);
90
+ const app = new AppDevShell(cwd, lpkBuild, force, config);
90
91
  await app.init();
91
92
  await app.build();
92
93
  await sleep(2000);
@@ -109,10 +109,10 @@ function convenientEnv() {
109
109
  }
110
110
 
111
111
  export class LpkBuild {
112
- constructor(cwd, lzcBuild = "lzc-build.yml") {
112
+ constructor(cwd, buildConfigFile) {
113
113
  this.pwd = cwd ?? process.cwd();
114
114
 
115
- this.optionsFilePath = path.join(this.pwd, lzcBuild);
115
+ this.optionsFilePath = path.join(this.pwd, buildConfigFile);
116
116
  this.options = loadFromYaml(this.optionsFilePath);
117
117
 
118
118
  this.manifestFilePath = this.options["manifest"]
@@ -33,11 +33,11 @@ import { collectContextFromDockerFile } from "./lpk_devshell_docker.js";
33
33
  // - 根据 backend api 判断一个 appid 是否属于 running
34
34
  // - 根据在 backend api 中判断同步的目录下是否存在文件 判断当前运行的 app 是否已经有一个挂载的实例,避免重复挂载
35
35
  class AppDevShellMonitor {
36
- constructor(cwd, pkgId) {
36
+ constructor(cwd, pkgId, buildConfigFile) {
37
37
  this.pwd = cwd ? path.resolve(cwd) : process.cwd();
38
38
  this.pkgId = pkgId;
39
39
 
40
- this.optionsFilePath = path.join(this.pwd, "lzc-build.yml");
40
+ this.optionsFilePath = path.join(this.pwd, buildConfigFile);
41
41
  this.options = loadFromYaml(this.optionsFilePath);
42
42
 
43
43
  this.manifestFilePath = this.options["manifest"]
@@ -104,19 +104,21 @@ class AppDevShellMonitor {
104
104
  }
105
105
 
106
106
  export class AppDevShell {
107
- constructor(cwd, lpkBuild, forceBuild = false) {
107
+ constructor(cwd, lpkBuild, forceBuild, buildConfigFile) {
108
108
  this.cwd = cwd;
109
109
  this.lpkBuild = lpkBuild;
110
- this.monitor = undefined;
111
110
  this.forceBuild = forceBuild;
111
+ this.buildConfigFile = buildConfigFile;
112
112
  this.isUserApp = false;
113
+ this.monitor = undefined;
113
114
  }
114
115
 
115
116
  async init() {
116
117
  const manifest = await this.lpkBuild.getManifest();
117
118
  this.monitor = await new AppDevShellMonitor(
118
119
  this.cwd,
119
- manifest["package"]
120
+ manifest["package"],
121
+ this.buildConfigFile
120
122
  ).init();
121
123
  this.isUserApp = isUserApp(manifest);
122
124
  }
@@ -242,11 +244,15 @@ export class AppDevShell {
242
244
  });
243
245
 
244
246
  // 在生成 manifest.yml 之前合并 lzc-build.yml devshell 字段的值
247
+ // 并加上 health_check 字段
245
248
  this.lpkBuild.onBeforeDumpYaml(async (manifest, options) => {
246
249
  logger.debug("merge lzc-build.yml devshell services\n", options);
247
250
  const devshell = {
248
251
  application: {
249
252
  devshell: options["devshell"],
253
+ health_check: {
254
+ test_url: `app.${manifest["package"]}.lzcapp/__isdevshell`,
255
+ },
250
256
  },
251
257
  };
252
258
  return mergeYamlInMemory([manifest, devshell]);
@@ -425,7 +431,7 @@ class DevShell {
425
431
  const dest = `root@${host}:/lzcapp/cache/devshell`;
426
432
  try {
427
433
  execSync(
428
- `rsync ${rsyncDebug} --rsh='${rsh}' --recursive --relative --perms --update --filter=':- .gitignore' --ignore-errors --usermap=:nobody --groupmap=*:nobody . ${dest}`,
434
+ `rsync ${rsyncDebug} --rsh='${rsh}' --recursive --relative --perms --update --filter=':- .gitignore' --ignore-errors . ${dest}`,
429
435
  { stdio: ["ignore", "inherit", "inherit"] }
430
436
  );
431
437
  } catch (err) {
package/lib/box/index.js CHANGED
@@ -10,6 +10,14 @@ export function boxCommand(box) {
10
10
  await shellapi.setDefaultBox(boxname);
11
11
  },
12
12
  },
13
+ {
14
+ command: "default",
15
+ desc: "输出当前默认的盒子名",
16
+ handler: async () => {
17
+ await shellapi.init();
18
+ console.log(shellapi.boxname);
19
+ },
20
+ },
13
21
  {
14
22
  command: "list",
15
23
  desc: "查看盒子列表",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "files": [
6
6
  "template",