@lazycatcloud/lzc-cli 1.2.63 → 1.2.64
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 +4 -0
- package/lib/app/index.js +1 -0
- package/lib/app/lpk_installer.js +18 -12
- package/lib/debug_bridge.js +6 -1
- package/lib/utils.js +4 -5
- package/package.json +1 -1
package/changelog.md
CHANGED
package/lib/app/index.js
CHANGED
package/lib/app/lpk_installer.js
CHANGED
|
@@ -25,9 +25,9 @@ function findOnceLpkByDir(dir = process.cwd()) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class LpkInstaller {
|
|
28
|
-
constructor() {}
|
|
28
|
+
constructor() { }
|
|
29
29
|
|
|
30
|
-
async init() {}
|
|
30
|
+
async init() { }
|
|
31
31
|
|
|
32
32
|
// deploy 构建和安装
|
|
33
33
|
async deploy(builder) {
|
|
@@ -119,17 +119,23 @@ export class LpkInstaller {
|
|
|
119
119
|
fs.rmSync(tempDir, { recursive: true })
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
try {
|
|
123
|
+
const bridge = new DebugBridge()
|
|
124
|
+
await bridge.init()
|
|
125
|
+
logger.info("开始安装应用")
|
|
126
|
+
await bridge.install(pkgPath, manifest ? manifest["package"] : "")
|
|
127
|
+
logger.info("\n")
|
|
128
|
+
logger.info(`安装成功!`)
|
|
129
|
+
if (manifest) {
|
|
130
|
+
logger.info(
|
|
131
|
+
`👉 请在浏览器中访问 https://${manifest["application"]["subdomain"]}.${shellapi.boxname}.heiyu.space`
|
|
132
|
+
)
|
|
133
|
+
logger.info(`👉 并使用微服的用户名和密码登录`)
|
|
134
|
+
}
|
|
135
|
+
} catch(error) {
|
|
136
|
+
logger.error(
|
|
137
|
+
`安装失败: ${error}`
|
|
131
138
|
)
|
|
132
|
-
logger.info(`👉 并使用微服的用户名和密码登录`)
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
141
|
}
|
package/lib/debug_bridge.js
CHANGED
|
@@ -30,6 +30,7 @@ export function sshCmdArgs(...args) {
|
|
|
30
30
|
const defaultOptions = [
|
|
31
31
|
`-o "StrictHostKeyChecking=no"`,
|
|
32
32
|
`-o "UserKnownHostsFile=/dev/null"`,
|
|
33
|
+
`-o "ControlMaster=no"`,
|
|
33
34
|
"-q",
|
|
34
35
|
"-p 22222",
|
|
35
36
|
`${isTraceMode() ? "-v" : ""}`
|
|
@@ -126,7 +127,11 @@ export class DebugBridge {
|
|
|
126
127
|
return true
|
|
127
128
|
} catch (err) {
|
|
128
129
|
logger.debug("canPublicKey error: ", err)
|
|
129
|
-
|
|
130
|
+
if (err?.code == "ETIMEOUT") {
|
|
131
|
+
throw `域名解析失败,请检查代理软件是否对*.heiyu.space拦截`
|
|
132
|
+
} else {
|
|
133
|
+
return false
|
|
134
|
+
}
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
137
|
|
package/lib/utils.js
CHANGED
|
@@ -484,21 +484,20 @@ export async function resolveDomain(domain) {
|
|
|
484
484
|
try {
|
|
485
485
|
// Set machine's dns server as defalut dns server
|
|
486
486
|
dns.setServers(["[fc03:1136:3800::1]"])
|
|
487
|
-
|
|
488
487
|
const [ipv6Addresses, ipv4Addresses] = await Promise.allSettled([
|
|
489
488
|
__resolveDomain(domain, true),
|
|
490
489
|
__resolveDomain(domain, false)
|
|
491
490
|
])
|
|
492
491
|
if (ipv6Addresses.status == "fulfilled") {
|
|
493
492
|
return ipv6Addresses.value
|
|
494
|
-
} else if (ipv4Addresses.status
|
|
493
|
+
} else if (ipv4Addresses.status == "fulfilled") {
|
|
495
494
|
return ipv4Addresses.value
|
|
496
495
|
} else {
|
|
497
|
-
throw
|
|
496
|
+
throw ipv6Addresses.reason
|
|
498
497
|
}
|
|
499
498
|
} catch (error) {
|
|
500
|
-
logger.error(
|
|
501
|
-
throw
|
|
499
|
+
logger.error(`无法解析域名 ${domain}: `, error)
|
|
500
|
+
throw error
|
|
502
501
|
}
|
|
503
502
|
}
|
|
504
503
|
|