@lazycatcloud/lzc-cli 1.3.8 → 1.3.10

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,88 +1,100 @@
1
- # 1.3.8
1
+ # Changelog
2
+
3
+ ## [1.3.10](https://gitee.com/linakesi/lzc-cli/compare/v0.0.8...v1.3.10) (2025-08-15)
4
+
5
+ ### Bug Fixes
6
+
7
+ - `copy-image --arch` attributes are changed to optional values ([d9bfd45](https://gitee.com/linakesi/lzc-cli/commits/d9bfd45e78d24303e6e225b85bb08cba9e5a9c78))
8
+
9
+ ## 1.3.9
10
+
11
+ 1. copy-image 支持 `arch` 参数
12
+
13
+ ## 1.3.8
2
14
 
3
15
  1. 修复hellowrold路由路径不对
4
16
 
5
- # 1.3.7
17
+ ## 1.3.7
6
18
 
7
19
  1. 修复错误的 lzc-manifest 字段读取匹配
8
20
 
9
- # 1.3.6
21
+ ## 1.3.6
10
22
 
11
23
  1. 处理创建的应用模板 `routes` 字段命名错误问题
12
24
  2. 支持 lzc-manifest 模板语法解析
13
25
  3. 调整开发者 ssh key 授权用户提示文案
14
26
 
15
- # 1.3.5
27
+ ## 1.3.5
16
28
 
17
29
  1. 支持自定义的公钥
18
30
 
19
- # 1.3.4
31
+ ## 1.3.4
20
32
 
21
33
  1. 添加算力舱和浏览器插件打包
22
34
 
23
- # 1.3.3
35
+ ## 1.3.3
24
36
 
25
37
  1. 拷贝镜像过程中显示进度
26
38
  2. 支持查看已经拷贝的镜像记录
27
39
 
28
- # 1.3.2
40
+ ## 1.3.2
29
41
 
30
42
  1. 增加用户友好的上传 LPK 错误提示
31
43
 
32
- # 1.3.1
44
+ ## 1.3.1
33
45
 
34
46
  1. 升级 lzc-cli 1.3.1 版本
35
47
 
36
- # 1.2.65
48
+ ## 1.2.65
37
49
 
38
50
  1. 适配新版本开发者平台接口
39
51
 
40
- # 1.2.64
52
+ ## 1.2.64
41
53
 
42
54
  1. 升级 dozzle,支持查看所有容器日志
43
55
  2. 修复 devshell ssh 多路复用错误
44
56
 
45
- # 1.2.63
57
+ ## 1.2.63
46
58
 
47
59
  1. 处理开发者账号无法登陆问题
48
60
 
49
- # 1.2.62
61
+ ## 1.2.62
50
62
 
51
63
  1. 修复部分 windows 机器无法登陆开发者账号问题
52
64
 
53
- # 1.2.61
65
+ ## 1.2.61
54
66
 
55
67
  1. 修复 lzc-build 文件配置 `compose.override` 字段不生效问题
56
68
 
57
- # 1.2.60
69
+ ## 1.2.60
58
70
 
59
71
  1. 添加用户登录友好提示
60
72
  2. 移除已弃用模版
61
73
  3. 支持 lzc-build 文件配置 `compose.override` 字段
62
74
 
63
- # 1.2.59
75
+ ## 1.2.59
64
76
 
65
77
  1. 修复 copy-image 网关超时
66
78
  2. 当解析 manifest 失败的时候,继续安装
67
79
  3. 修复盒子 ingress 错误的时候,获取不到本地的默认盒子
68
80
 
69
- # 1.2.58
81
+ ## 1.2.58
70
82
 
71
83
  1. 使用 127.0.0.1 替代 localhost 避免解析错误
72
84
  2. 修复最新版本检测
73
85
 
74
- # 1.2.57
86
+ ## 1.2.57
75
87
 
76
88
  1. 支持独立添加公钥到开发者工具中去 `lzc-cli box add-public-key`
77
89
  2. 支持选择使用公钥类型,不再优先使用 id_ed25519
78
90
  3. 添加 nodejs 版本检测, 要求最低版本 >=18
79
91
  4. 添加 dns 解析错误提示
80
92
 
81
- # 1.2.56
93
+ ## 1.2.56
82
94
 
83
95
  1. 修复没有写权限的lpk文件,不能通过 lzc-cli app install 安装
84
96
 
85
- # 1.2.55
97
+ ## 1.2.55
86
98
 
87
99
  1. 添加 lzc-docker 命令
88
100
  2. 添加 lzc-docker-compose 命令
@@ -91,90 +103,90 @@
91
103
  5. 修复 lzc-cli zsh/bash 补全错误
92
104
  6. 隐藏 triggerApk 错误
93
105
 
94
- # 1.2.54
106
+ ## 1.2.54
95
107
 
96
108
  1. 添加 lzc-cli docker 命令
97
109
  2. 添加 lzc-cli docker-compose 命令
98
110
  3. 修复其他同步卡顿问题
99
111
 
100
- # 1.2.53
112
+ ## 1.2.53
101
113
 
102
114
  1. 修复 devshell 模型下,环境变量中有空格导致export错误
103
115
  2. 优化生成 apk shell 错误提示
104
116
 
105
- # 1.2.52
117
+ ## 1.2.52
106
118
 
107
119
  1. appstore api 变更
108
120
 
109
- # 1.2.51
121
+ ## 1.2.51
110
122
 
111
123
  1. 添加 lzc-cli 版本信息到缓存 hash 中,当 lzc-cli 升级后,devshell 需要重新部署
112
124
 
113
- # 1.2.50
125
+ ## 1.2.50
114
126
 
115
127
  1. 添加 lzc-cli appstore copy-image <image-name> 命令
116
128
 
117
- # 1.2.49
129
+ ## 1.2.49
118
130
 
119
131
  1. 修复 nc 命令没有发现
120
132
 
121
- # 1.2.48
133
+ ## 1.2.48
122
134
 
123
135
  1. 添加 rsync 版本限制
124
136
  2. 修复触发生成 apk-shell api 变更
125
137
 
126
- # 1.2.46
138
+ ## 1.2.46
127
139
 
128
140
  1. 修复拉取构建的镜像dns错误
129
141
 
130
- # 1.2.45
142
+ ## 1.2.45
131
143
 
132
144
  1. 修复 helloworld 404 错误
133
145
 
134
- # 1.2.44
146
+ ## 1.2.44
135
147
 
136
148
  1. 修复查询状态等接口没有使用ipv6地址
137
149
  2. 修复 rsync 进程没有系统环境变量
138
150
 
139
- # 1.2.43
151
+ ## 1.2.43
140
152
 
141
153
  1. 支持通过命令行注册应用,新上架的应用不再需要通过界面配置
142
154
 
143
- # 1.2.42
155
+ ## 1.2.42
144
156
 
145
157
  1. 限制 subdomain 为空时,构建和安装失败
146
158
  2. 修复创建的模板中没有带上 .gitingore 文件
147
159
 
148
- # 1.2.41
160
+ ## 1.2.41
149
161
 
150
162
  1. 使用 rsync daemon 修复 Windows 系统下 rsync 无法使用本机原生 ssh 传输
151
163
 
152
- # 1.2.39
164
+ ## 1.2.39
153
165
 
154
166
  1. 修复 Windows 系统下,无法构建和安装问题
155
167
 
156
- # 1.2.38
168
+ ## 1.2.38
157
169
 
158
170
  1. 修复 Windows 系统下,buildscript 脚本执行错误,导致无法构建
159
171
 
160
- # 1.2.37
172
+ ## 1.2.37
161
173
 
162
174
  1. 修复 Windows 系统下,构建包时获取 LocalIP 错误
163
175
 
164
- # 1.2.34
176
+ ## 1.2.34
165
177
 
166
178
  1. devshell 模式下,默认打开后台常驻
167
179
 
168
- # 1.2.29
180
+ ## 1.2.29
169
181
 
170
182
  1. 修复开发者第一次devshelll需要填写密码,需要安装最新开发者工具(0.1.6)
171
183
  2. 调整文案,移除不必要的日志
172
184
 
173
- # 1.2.28
185
+ ## 1.2.28
174
186
 
175
187
  1. 简化创建项目流程
176
188
  2. 支持自动请求生成安卓所需要apk包
177
189
 
178
- # 1.2.27
190
+ ## 1.2.27
179
191
 
180
192
  1. 修复第一次使用开发者 `dns` 生效慢的问题
@@ -68,13 +68,21 @@ export function appstoreCommand(program) {
68
68
  }
69
69
  },
70
70
  {
71
- command: "copy-image <imageName>",
72
- desc: "复制镜像至懒猫微服官方源",
73
- handler: async ({ imageName }) => {
74
- const uploadUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/copy?image=${imageName}`
75
- const progressUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/progress?image=${imageName}`
71
+ command: "copy-image <img>",
72
+ desc: `复制镜像至懒猫微服官方源`,
73
+ builder: (yargs) => {
74
+ yargs.option("arch", {
75
+ describe: "image arch 'amd64', 'arm64'",
76
+ default: "amd64",
77
+ type: "string"
78
+ })
79
+ return yargs
80
+ },
81
+ handler: async ({ img: imageName, arch: platform }) => {
82
+ const uploadUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/copy?image=${imageName}&platform=${platform}`
83
+ const progressUrl = `${appStoreServerUrl}/api/v3/developer/app/docker/image/push/v3/progress?image=${imageName}&platform=${platform}`
76
84
  logger.info(
77
- `Waiting ... ( copy ${imageName} to lazycat offical registry)`
85
+ `Waiting ... ( copy ${imageName} (${platform}) to lazycat offical registry)`
78
86
  )
79
87
  try {
80
88
  const resp = await request(uploadUrl)
@@ -85,61 +93,69 @@ export function appstoreCommand(program) {
85
93
  return
86
94
  }
87
95
  sleep(1000)
88
- let prevLineCount = 0; // 新增:记录上次输出行数
96
+ let prevLineCount = 0 // 新增:记录上次输出行数
89
97
  let layers = []
90
98
 
91
99
  let refreshProgress = (lys) => {
92
100
  // 关键修改:动态回退多行
93
- process.stdout.write('\x1B[?25l'); // 隐藏光标
101
+ process.stdout.write("\x1B[?25l") // 隐藏光标
94
102
  if (prevLineCount > 0) {
95
- process.stdout.write(`\x1B[${prevLineCount}A`); // 移动光标到之前输出的起始行
103
+ process.stdout.write(`\x1B[${prevLineCount}A`) // 移动光标到之前输出的起始行
96
104
  }
97
105
 
98
106
  // 构建多行进度字符串
99
- let output = [];
100
- (lys || []).forEach(v => {
101
- const progressBar = '#'.repeat(v.progress) + ' '.repeat(100 - v.progress);
102
- output.push(`${v.hash.substring(0, 8)}: [${progressBar}] ${v.progress}%`);
103
- });
107
+ let output = []
108
+ ;(lys || []).forEach((v) => {
109
+ const progressBar =
110
+ "#".repeat(v.progress) + " ".repeat(100 - v.progress)
111
+ output.push(
112
+ `${v.hash.substring(0, 8)}: [${progressBar}] ${v.progress}%`
113
+ )
114
+ })
104
115
 
105
116
  // 清除旧行并写入新内容
106
- output.forEach(line => {
107
- process.stdout.write('\x1B[2K'); // 清除当前行
108
- process.stdout.write(line + '\n');
109
- });
110
- prevLineCount = output.length; // 记录本次输出行数
111
- process.stdout.write('\x1B[?25h'); // 恢复光标显示
117
+ output.forEach((line) => {
118
+ process.stdout.write("\x1B[2K") // 清除当前行
119
+ process.stdout.write(line + "\n")
120
+ })
121
+ prevLineCount = output.length // 记录本次输出行数
122
+ process.stdout.write("\x1B[?25h") // 恢复光标显示
112
123
  }
113
124
 
114
- for (; ;) {
115
- const pgsResp = await request(progressUrl);
125
+ for (;;) {
126
+ const pgsResp = await request(progressUrl)
116
127
  if (pgsResp.ok) {
117
- const pgs = JSON.parse(await pgsResp.text());
128
+ const pgs = JSON.parse(await pgsResp.text())
118
129
  if (pgs.finished) {
119
- (layers ? layers : [])?.forEach(v => {
130
+ ;(layers ? layers : [])?.forEach((v) => {
120
131
  v.progress = 100
121
- });
132
+ })
122
133
  refreshProgress(layers)
123
- process.stdout.write("\n");
134
+ process.stdout.write("\n")
124
135
  if (pgs.errmsg) {
125
- logger.error("failed to copyimage ", imageName, " err:", pgs.errmsg);
126
- break;
136
+ logger.error(
137
+ "failed to copyimage ",
138
+ imageName,
139
+ " err:",
140
+ pgs.errmsg
141
+ )
142
+ break
127
143
  }
128
- logger.info("uploaded: ", pgs.lzc_image);
129
- break;
144
+ logger.info("uploaded: ", pgs.lzc_image)
145
+ break
130
146
  }
131
147
  layers = pgs?.layers
132
148
  refreshProgress(layers)
133
- await sleep(1000);
149
+ await sleep(1000)
134
150
  } else {
135
- logger.error("error: ", await resp.text());
136
- break;
151
+ logger.error("error: ", await resp.text())
152
+ break
137
153
  }
138
154
  }
139
155
  } catch (err) {
140
156
  console.error(err)
141
157
  }
142
- },
158
+ }
143
159
  },
144
160
  {
145
161
  command: "my-images",
@@ -151,17 +167,20 @@ export function appstoreCommand(program) {
151
167
  if (resp.ok) {
152
168
  const ilist = JSON.parse(await resp.text())
153
169
  ilist.sort((a, b) => {
154
- return new Date(b.UpdatedAt).getTime() - new Date(a.UpdatedAt).getTime()
170
+ return (
171
+ new Date(b.UpdatedAt).getTime() -
172
+ new Date(a.UpdatedAt).getTime()
173
+ )
155
174
  })
156
175
  const tableItems = []
157
- ilist?.forEach(v => {
176
+ ilist?.forEach((v) => {
158
177
  if (v.errmsg) {
159
178
  return
160
179
  }
161
180
  tableItems.push({
162
181
  "Source Image": v.source_image,
163
182
  "Lazycat Image": v.lzc_image,
164
- "Updated At": new Date(v.UpdatedAt).toLocaleString(),
183
+ "Updated At": new Date(v.UpdatedAt).toLocaleString()
165
184
  })
166
185
  })
167
186
  console.table(tableItems)
@@ -171,8 +190,8 @@ export function appstoreCommand(program) {
171
190
  } catch (err) {
172
191
  console.error(err)
173
192
  }
174
- },
175
- },
193
+ }
194
+ }
176
195
  ]
177
196
 
178
197
  program.command({
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
+ "release": "release-it patch",
6
7
  "prepublishOnly": "node check-changelog.js"
7
8
  },
8
9
  "files": [
@@ -55,8 +56,10 @@
55
56
  "yargs": "^17.7.2"
56
57
  },
57
58
  "devDependencies": {
59
+ "@release-it/conventional-changelog": "^10.0.1",
58
60
  "@types/command-exists": "^1.2.3",
59
- "prettier": "^3.3.3"
61
+ "prettier": "^3.3.3",
62
+ "release-it": "^19.0.4"
60
63
  },
61
64
  "prettier": {
62
65
  "bracketSameLine": true,
@@ -64,6 +67,24 @@
64
67
  "semi": false,
65
68
  "trailingComma": "none"
66
69
  },
70
+ "release-it": {
71
+ "git": {
72
+ "requireCleanWorkingDir": false,
73
+ "commitMessage": "chore: release v${version}",
74
+ "commit": true,
75
+ "tag": true,
76
+ "push": false
77
+ },
78
+ "npm": {
79
+ "publish": false
80
+ },
81
+ "plugins": {
82
+ "@release-it/conventional-changelog": {
83
+ "preset": "angular",
84
+ "infile": "changelog.md"
85
+ }
86
+ }
87
+ },
67
88
  "publishConfig": {
68
89
  "registry": "https://registry.npmjs.org",
69
90
  "access": "public"
package/scripts/cli.js CHANGED
@@ -51,6 +51,7 @@ const program = yargs(hideBin(process.argv))
51
51
  default: false
52
52
  })
53
53
  .completion("completion", false)
54
+ .wrap(null) // https://yargs.js.org/docs/#api-reference-wrapcolumns
54
55
 
55
56
  configCommand(program)
56
57
  boxCommand(program)