@lazycatcloud/lzc-cli 1.2.4 → 1.2.6
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/README.md +1 -8
- package/lib/app/lpk_debug_bridge.js +13 -7
- package/lib/app/lpk_devshell_docker.js +1 -1
- package/lib/app/lpk_installer.js +2 -2
- package/lib/appstore/index.js +10 -1
- package/lib/appstore/publish.js +2 -1
- package/lib/shellapi.proto +21 -23
- package/package.json +2 -14
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
1. `ssh`
|
|
6
6
|
2. `ssh-copy-id`
|
|
7
7
|
3. `rsync`
|
|
8
|
+
4. 盒子中安装开发者工具应用
|
|
8
9
|
|
|
9
10
|
#### 快速上手
|
|
10
11
|
|
|
@@ -37,11 +38,3 @@ lzc-cli appstore publish
|
|
|
37
38
|
#### 1. 开发者工具 ssh 的帐号密码是多少?
|
|
38
39
|
|
|
39
40
|
现在帐号密码设置为 box:box,后面会使用 pam 模块对接盒子帐号体系。
|
|
40
|
-
|
|
41
|
-
#### 2. 如何切换默认的开发的盒子?
|
|
42
|
-
|
|
43
|
-
目前不支持通过 lzc-cli 工具切换默认的盒子,所以你需要在 lzc-client-desktop 客户端上点击你要使用的盒子来切换。
|
|
44
|
-
|
|
45
|
-
#### 3. 如果在盒子中构建镜像? 不想在本地构建
|
|
46
|
-
|
|
47
|
-
现在已经把在盒子中构建镜像的功能去掉了,只能在本地或者其他地方构建好,然后指定 image 字段来选择你需要的开发环境。
|
|
@@ -21,16 +21,20 @@ export class DebugBridge {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async install(lpkPath) {
|
|
24
|
+
async install(lpkPath, pkgId) {
|
|
25
25
|
if (!(await this.canPublicKey())) {
|
|
26
26
|
await this.sshCopyId();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const stream = fs.createReadStream(lpkPath);
|
|
30
|
-
const ssh = spawn(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const ssh = spawn(
|
|
31
|
+
this.sshCmd,
|
|
32
|
+
[`install --uid ${this.uid} --pkgId ${pkgId}`],
|
|
33
|
+
{
|
|
34
|
+
shell: true,
|
|
35
|
+
stdio: ["pipe", "inherit", "inherit"],
|
|
36
|
+
}
|
|
37
|
+
);
|
|
34
38
|
stream.pipe(ssh.stdin);
|
|
35
39
|
return new Promise((resolve, reject) => {
|
|
36
40
|
ssh.on("close", (code) => {
|
|
@@ -110,7 +114,7 @@ export class DebugBridge {
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
async buildImage(label, contextTar) {
|
|
113
|
-
const tag = `
|
|
117
|
+
const tag = `debug.bridge/${label}`;
|
|
114
118
|
const stream = fs.createReadStream(contextTar);
|
|
115
119
|
const ssh = spawn(this.sshCmd, [`build --tag ${tag}`], {
|
|
116
120
|
shell: true,
|
|
@@ -119,7 +123,9 @@ export class DebugBridge {
|
|
|
119
123
|
stream.pipe(ssh.stdin);
|
|
120
124
|
return new Promise((resolve, reject) => {
|
|
121
125
|
ssh.on("close", (code) => {
|
|
122
|
-
code == 0
|
|
126
|
+
code == 0
|
|
127
|
+
? resolve(`dev.${this.boxname}.heiyu.space/${tag}`)
|
|
128
|
+
: reject("在盒子中构建 image 失败");
|
|
123
129
|
});
|
|
124
130
|
}).finally(() => {
|
|
125
131
|
fs.rmSync(contextTar);
|
package/lib/app/lpk_installer.js
CHANGED
|
@@ -38,7 +38,7 @@ export class LpkInstaller {
|
|
|
38
38
|
let pkgPath = await builder.exec();
|
|
39
39
|
logger.info("开始部署应用");
|
|
40
40
|
const bridge = new DebugBridge();
|
|
41
|
-
await bridge.install(pkgPath);
|
|
41
|
+
await bridge.install(pkgPath, manifest["package"]);
|
|
42
42
|
const appUrl = `https://${manifest["application"]["subdomain"]}.${shellapi.boxname}.heiyu.space`;
|
|
43
43
|
logger.info(`👉 请在浏览器中访问 ${appUrl}`);
|
|
44
44
|
}
|
|
@@ -98,7 +98,7 @@ export class LpkInstaller {
|
|
|
98
98
|
|
|
99
99
|
const bridge = new DebugBridge();
|
|
100
100
|
logger.info("开始安装应用");
|
|
101
|
-
await bridge.install(pkgPath);
|
|
101
|
+
await bridge.install(pkgPath, manifest["package"]);
|
|
102
102
|
logger.info(`安装成功!`);
|
|
103
103
|
logger.info(
|
|
104
104
|
`👉 请在浏览器中访问 https://${manifest["application"]["subdomain"]}.${shellapi.boxname}.heiyu.space`
|
package/lib/appstore/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Publish } from "./publish.js";
|
|
2
2
|
import { reLogin } from "./login.js";
|
|
3
|
+
import fs from "node:fs";
|
|
3
4
|
|
|
4
5
|
export function appstoreCommand(program) {
|
|
5
6
|
let subCommands = [
|
|
@@ -19,9 +20,17 @@ export function appstoreCommand(program) {
|
|
|
19
20
|
describe: "更改日志",
|
|
20
21
|
type: "string",
|
|
21
22
|
});
|
|
23
|
+
args.option("F", {
|
|
24
|
+
alias: "file",
|
|
25
|
+
describe: "更改日志文件",
|
|
26
|
+
type: "string",
|
|
27
|
+
});
|
|
22
28
|
},
|
|
23
|
-
handler: async ({ pkgPath, changelog }) => {
|
|
29
|
+
handler: async ({ pkgPath, changelog, file }) => {
|
|
24
30
|
const p = new Publish();
|
|
31
|
+
if (!changelog && file) {
|
|
32
|
+
changelog = fs.readFileSync(file, "utf8");
|
|
33
|
+
}
|
|
25
34
|
await p.publish(pkgPath, changelog);
|
|
26
35
|
},
|
|
27
36
|
},
|
package/lib/appstore/publish.js
CHANGED
package/lib/shellapi.proto
CHANGED
|
@@ -143,9 +143,9 @@ message BoxSetting {
|
|
|
143
143
|
optional bool enabled = 3;
|
|
144
144
|
|
|
145
145
|
message AuthInfo {
|
|
146
|
-
string user =
|
|
147
|
-
string password =
|
|
148
|
-
optional string password_hash =
|
|
146
|
+
string user = 1;
|
|
147
|
+
string password = 2;
|
|
148
|
+
optional string password_hash = 3;
|
|
149
149
|
}
|
|
150
150
|
optional AuthInfo auth = 4;
|
|
151
151
|
|
|
@@ -227,27 +227,31 @@ message BoxInfo {
|
|
|
227
227
|
|
|
228
228
|
string box_home_url = 3;
|
|
229
229
|
|
|
230
|
-
string box_domain =
|
|
230
|
+
string box_domain = 4;
|
|
231
231
|
|
|
232
|
-
string box_virtual_ip =
|
|
232
|
+
string box_virtual_ip = 5;
|
|
233
233
|
|
|
234
|
-
BoxStatus status =
|
|
234
|
+
BoxStatus status = 6;
|
|
235
235
|
|
|
236
|
-
string status_reason =
|
|
237
|
-
optional FailedStatus failed_status =
|
|
236
|
+
string status_reason = 7;
|
|
237
|
+
optional FailedStatus failed_status = 8;
|
|
238
238
|
|
|
239
|
-
string login_user =
|
|
240
|
-
bool is_admin_login =
|
|
241
|
-
|
|
242
|
-
string auth_token = 9;
|
|
239
|
+
string login_user = 9;
|
|
240
|
+
bool is_admin_login = 10;
|
|
243
241
|
|
|
244
242
|
// 此盒子属于当前客户端的默认盒子
|
|
245
|
-
bool is_default_box =
|
|
243
|
+
bool is_default_box = 11;
|
|
244
|
+
|
|
245
|
+
// 底层网络的连接类型,如果是Relay/BLE这类则客户端一般需要进行提示并且限制访问流量要求大的应用
|
|
246
|
+
LowNetworkConnType conn_type = 12;
|
|
247
|
+
}
|
|
246
248
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
enum LowNetworkConnType {
|
|
250
|
+
NOT_CONNECTED = 0; //未建立连接
|
|
251
|
+
BLE = 100; //通过蓝牙建立的慢速连接
|
|
252
|
+
RELAY = 200; //通过中继建立的慢速连接
|
|
253
|
+
NORMAL = 300; //正常连接,可能是通过多层或一层局域网也可能是互联网等方式建立的连接
|
|
254
|
+
DIRECT = 400; //通过局域网等高速通道建立的连接
|
|
251
255
|
}
|
|
252
256
|
|
|
253
257
|
message BoxList {
|
|
@@ -275,12 +279,6 @@ message ShellCoreInfo {
|
|
|
275
279
|
|
|
276
280
|
string device_os = 9;
|
|
277
281
|
|
|
278
|
-
// // 设备 DNS 服务器地址
|
|
279
|
-
// string dns_ip = 10;
|
|
280
|
-
|
|
281
|
-
// // 内存占用
|
|
282
|
-
// int32 memory_usage = 11;
|
|
283
|
-
|
|
284
282
|
// 额外的调试信息
|
|
285
283
|
map<string, string> debug_extras = 101;
|
|
286
284
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "lazycat cloud developer kit",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "tap",
|
|
7
|
-
"snap": "tap"
|
|
8
|
-
},
|
|
9
|
-
"tap": {
|
|
10
|
-
"node-arg": [
|
|
11
|
-
"--loader=esmock",
|
|
12
|
-
"--experimental-vm-modules"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
5
|
"files": [
|
|
16
6
|
"template",
|
|
17
7
|
"scripts",
|
|
@@ -52,9 +42,7 @@
|
|
|
52
42
|
},
|
|
53
43
|
"devDependencies": {
|
|
54
44
|
"@types/command-exists": "^1.2.0",
|
|
55
|
-
"
|
|
56
|
-
"prettier": "^2.5.0",
|
|
57
|
-
"tap": "^16.3.0"
|
|
45
|
+
"prettier": "^2.5.0"
|
|
58
46
|
},
|
|
59
47
|
"publishConfig": {
|
|
60
48
|
"registry": "https://registry.npmjs.org",
|