@lazycatcloud/lzc-cli 1.2.65 → 1.3.2
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 +8 -0
- package/lib/appstore/login.js +15 -5
- package/lib/appstore/publish.js +11 -6
- package/package.json +1 -1
package/changelog.md
CHANGED
package/lib/appstore/login.js
CHANGED
|
@@ -31,11 +31,17 @@ async function login(username, password) {
|
|
|
31
31
|
})
|
|
32
32
|
.then(async (res) => {
|
|
33
33
|
let bodyText = await res.text()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
try {
|
|
35
|
+
let body = JSON.parse(bodyText)
|
|
36
|
+
if (body.success) {
|
|
37
|
+
return Promise.resolve(body.data)
|
|
38
|
+
}
|
|
39
|
+
throw body
|
|
40
|
+
} catch (error) {
|
|
41
|
+
error.responseStatus = res.status
|
|
42
|
+
error.responseBody = bodyText
|
|
43
|
+
return Promise.reject(error)
|
|
37
44
|
}
|
|
38
|
-
return Promise.reject(body.message)
|
|
39
45
|
})
|
|
40
46
|
.then((data) => {
|
|
41
47
|
env.set({ token: data.token }, true)
|
|
@@ -94,7 +100,11 @@ async function interactiveLogin() {
|
|
|
94
100
|
await login(info.username, info.password)
|
|
95
101
|
} catch (e) {
|
|
96
102
|
logger.debug("login error: ", e)
|
|
97
|
-
|
|
103
|
+
if (e?.errorCode == 0 || e?.message == "密码错误") {
|
|
104
|
+
logger.error("帐号或者密码错误,请重新输入!")
|
|
105
|
+
} else {
|
|
106
|
+
logger.error(`登录失败,${e?.message ?? e}`)
|
|
107
|
+
}
|
|
98
108
|
return interactiveLogin()
|
|
99
109
|
}
|
|
100
110
|
}
|
package/lib/appstore/publish.js
CHANGED
|
@@ -224,12 +224,6 @@ export class Publish {
|
|
|
224
224
|
|
|
225
225
|
await autoLogin()
|
|
226
226
|
|
|
227
|
-
if (!changelog) {
|
|
228
|
-
const answer = await askChangeLog(locale)
|
|
229
|
-
changelog = answer.changelog
|
|
230
|
-
}
|
|
231
|
-
changelog = changelog.trim() // clean space ^:)
|
|
232
|
-
|
|
233
227
|
logger.info("正在提交审核...")
|
|
234
228
|
const form = new FormData()
|
|
235
229
|
form.append("file", fs.createReadStream(pkgPath))
|
|
@@ -248,6 +242,17 @@ export class Publish {
|
|
|
248
242
|
}
|
|
249
243
|
const lpkInfo = await JSON.parse(text)
|
|
250
244
|
logger.debug("upload lpk response", lpkInfo)
|
|
245
|
+
if (res.status >= 400) {
|
|
246
|
+
logger.error(`LPK 文件上传失败,err: ${lpkInfo?.message ?? lpkInfo}`)
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 填写更新日志
|
|
251
|
+
if (!changelog) {
|
|
252
|
+
const answer = await askChangeLog(locale)
|
|
253
|
+
changelog = answer.changelog
|
|
254
|
+
}
|
|
255
|
+
changelog = changelog.trim() // clean space ^:)
|
|
251
256
|
|
|
252
257
|
const sendURL = this.baseUrl + `/app/${lpkInfo.package}/review/create`
|
|
253
258
|
logger.debug("publish url is", sendURL)
|