@lazycatcloud/lzc-cli 1.2.41 → 1.2.43
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 +42 -0
- package/lib/app/lpk_build.js +5 -0
- package/lib/app/lpk_create.js +10 -2
- package/lib/app/lpk_create_generator.js +17 -5
- package/lib/app/lpk_installer.js +5 -1
- package/lib/appstore/prePublish.js +4 -33
- package/lib/appstore/publish.js +145 -7
- package/lib/utils.js +17 -3
- package/package.json +3 -2
- package/scripts/cli.js +2 -1
- package/template/lite/_gitignore +4 -0
- package/template/vue/_gitignore +25 -0
package/changelog.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 1.2.43
|
|
2
|
+
|
|
3
|
+
1. 支持通过命令行注册应用,新上架的应用不再需要通过界面配置
|
|
4
|
+
|
|
5
|
+
# 1.2.42
|
|
6
|
+
|
|
7
|
+
1. 限制 subdomain 为空时,构建和安装失败
|
|
8
|
+
2. 修复创建的模板中没有带上 .gitingore 文件
|
|
9
|
+
|
|
10
|
+
# 1.2.41
|
|
11
|
+
|
|
12
|
+
1. 使用 rsync daemon 修复 Windows 系统下 rsync 无法使用本机原生 ssh 传输
|
|
13
|
+
|
|
14
|
+
# 1.2.39
|
|
15
|
+
|
|
16
|
+
1. 修复 Windows 系统下,无法构建和安装问题
|
|
17
|
+
|
|
18
|
+
# 1.2.38
|
|
19
|
+
|
|
20
|
+
1. 修复 Windows 系统下,buildscript 脚本执行错误,导致无法构建
|
|
21
|
+
|
|
22
|
+
# 1.2.37
|
|
23
|
+
|
|
24
|
+
1. 修复 Windows 系统下,构建包时获取 LocalIP 错误
|
|
25
|
+
|
|
26
|
+
# 1.2.34
|
|
27
|
+
|
|
28
|
+
1. devshell 模式下,默认打开后台常驻
|
|
29
|
+
|
|
30
|
+
# 1.2.29
|
|
31
|
+
|
|
32
|
+
1. 修复开发者第一次devshelll需要填写密码,需要安装最新开发者工具(0.1.6)
|
|
33
|
+
2. 调整文案,移除不必要的日志
|
|
34
|
+
|
|
35
|
+
# 1.2.28
|
|
36
|
+
|
|
37
|
+
1. 简化创建项目流程
|
|
38
|
+
2. 支持自动请求生成安卓所需要apk包
|
|
39
|
+
|
|
40
|
+
# 1.2.27
|
|
41
|
+
|
|
42
|
+
1. 修复第一次使用开发者 `dns` 生效慢的问题
|
package/lib/app/lpk_build.js
CHANGED
|
@@ -187,6 +187,11 @@ export class LpkBuild {
|
|
|
187
187
|
if (!isValidPackageName(this.manifest["package"])) {
|
|
188
188
|
throw `${this.manifest["package"]} 含有非法字符,请使用正确的包名格式(java的包名格式),如:cloud.lazycat.apps.video`
|
|
189
189
|
}
|
|
190
|
+
|
|
191
|
+
if (!this.manifest["application"]["subdomain"]) {
|
|
192
|
+
throw `application 模块下的 subdomain 字段不能为空`
|
|
193
|
+
}
|
|
194
|
+
|
|
190
195
|
return this.manifest
|
|
191
196
|
}
|
|
192
197
|
|
package/lib/app/lpk_create.js
CHANGED
|
@@ -28,7 +28,11 @@ export class LpkManifest {
|
|
|
28
28
|
if (!manifestFilePath) {
|
|
29
29
|
manifestFilePath = path.join(
|
|
30
30
|
this.pwd,
|
|
31
|
-
"
|
|
31
|
+
"..",
|
|
32
|
+
"..",
|
|
33
|
+
"template",
|
|
34
|
+
"_lpk",
|
|
35
|
+
"manifest.yml.in"
|
|
32
36
|
)
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -88,7 +92,11 @@ export class TemplateInit {
|
|
|
88
92
|
// 优先使用模板项目自定义的模板文件
|
|
89
93
|
const typeTemplatePath = path.join(
|
|
90
94
|
contextDirname(import.meta.url),
|
|
91
|
-
|
|
95
|
+
"..",
|
|
96
|
+
"..",
|
|
97
|
+
"template",
|
|
98
|
+
"_lpk",
|
|
99
|
+
`${this.type}.manifest.yml.in`
|
|
92
100
|
)
|
|
93
101
|
const templatePath = isFileExist(typeTemplatePath) ? typeTemplatePath : ""
|
|
94
102
|
await this.lpkManifest.init(templatePath, true)
|
|
@@ -10,10 +10,10 @@ import logger from "loglevel"
|
|
|
10
10
|
const __dirname = contextDirname(import.meta.url)
|
|
11
11
|
|
|
12
12
|
async function loadFiles(dirPath, prefix = "") {
|
|
13
|
-
const templateRoot = path.join(__dirname, "
|
|
13
|
+
const templateRoot = path.join(__dirname, "..", "..", "template")
|
|
14
14
|
const templateDir = path.join(templateRoot, dirPath)
|
|
15
15
|
|
|
16
|
-
const _files = await glob(["**/*"], { cwd: templateDir })
|
|
16
|
+
const _files = await glob(["**/*", "**/.*", ".*"], { cwd: templateDir })
|
|
17
17
|
let content
|
|
18
18
|
let files = {}
|
|
19
19
|
for (let p of _files) {
|
|
@@ -59,7 +59,11 @@ function appendREADME(dir) {
|
|
|
59
59
|
const readme = path.resolve(dir, "README.md")
|
|
60
60
|
const readmeTemplate = path.resolve(
|
|
61
61
|
__dirname,
|
|
62
|
-
"
|
|
62
|
+
"..",
|
|
63
|
+
"..",
|
|
64
|
+
"template",
|
|
65
|
+
"_lpk",
|
|
66
|
+
"README.md"
|
|
63
67
|
)
|
|
64
68
|
if (!isFileExist(readme)) {
|
|
65
69
|
fs.copyFileSync(readmeTemplate, readme)
|
|
@@ -85,14 +89,22 @@ function vueTemplate(type) {
|
|
|
85
89
|
|
|
86
90
|
const lzcBuildTemplatePath = path.resolve(
|
|
87
91
|
__dirname,
|
|
88
|
-
|
|
92
|
+
"..",
|
|
93
|
+
"..",
|
|
94
|
+
"template",
|
|
95
|
+
"_lpk",
|
|
96
|
+
"vue.lzc-build.yml.in"
|
|
89
97
|
)
|
|
90
98
|
logger.debug("复制", lzcBuildTemplatePath)
|
|
91
99
|
fs.copyFileSync(lzcBuildTemplatePath, path.resolve(name, "lzc-build.yml"))
|
|
92
100
|
|
|
93
101
|
const iconPngPath = path.resolve(
|
|
94
102
|
__dirname,
|
|
95
|
-
"
|
|
103
|
+
"..",
|
|
104
|
+
"..",
|
|
105
|
+
"template",
|
|
106
|
+
"_lpk",
|
|
107
|
+
"lazycat.png"
|
|
96
108
|
)
|
|
97
109
|
fs.copyFileSync(iconPngPath, path.resolve(name, "lazycat.png"))
|
|
98
110
|
|
package/lib/app/lpk_installer.js
CHANGED
|
@@ -93,8 +93,12 @@ export class LpkInstaller {
|
|
|
93
93
|
const tempDir = fs.mkdtempSync(".lzc-cli-install")
|
|
94
94
|
let manifest
|
|
95
95
|
try {
|
|
96
|
-
unzipSync(pkgPath, tempDir)
|
|
96
|
+
unzipSync(pkgPath, tempDir, ["manifest.yml", "icon.png"])
|
|
97
97
|
manifest = loadFromYaml(path.join(tempDir, "manifest.yml"))
|
|
98
|
+
if (!manifest["application"]["subdomain"]) {
|
|
99
|
+
throw "manifest.yml 中的 `application.subdomain` 字段不能为空"
|
|
100
|
+
}
|
|
101
|
+
|
|
98
102
|
logger.debug("是否生成APK:", installConfig.apk)
|
|
99
103
|
if (installConfig.apk) {
|
|
100
104
|
await triggerApk(
|
|
@@ -6,6 +6,7 @@ import inquirer from "inquirer"
|
|
|
6
6
|
import path from "node:path"
|
|
7
7
|
import { isFileExist, isPngWithFile, unzipSync } from "../utils.js"
|
|
8
8
|
import env from "../env.js"
|
|
9
|
+
import { Publish } from "./publish.js"
|
|
9
10
|
|
|
10
11
|
async function askChangeLog() {
|
|
11
12
|
const noEmpty = (value) => value != ""
|
|
@@ -37,36 +38,6 @@ export class PrePublish {
|
|
|
37
38
|
this.baseUrl = baseUrl
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
/**
|
|
41
|
-
* @param {string} raw
|
|
42
|
-
*/
|
|
43
|
-
isJSON(raw) {
|
|
44
|
-
const ml = raw.length
|
|
45
|
-
if (ml <= 1) return false
|
|
46
|
-
return raw[0] == "{" && raw[ml - 1] == "}"
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
preCheck(pkgPath) {
|
|
50
|
-
const tempDir = fs.mkdtempSync(".lzc-cli-publish")
|
|
51
|
-
try {
|
|
52
|
-
unzipSync(pkgPath, tempDir)
|
|
53
|
-
if (isFileExist(path.join(tempDir, "devshell"))) {
|
|
54
|
-
logger.error(
|
|
55
|
-
"不能发布一个devshell的版本,请重新使用 `lzc-cli project build` 构建"
|
|
56
|
-
)
|
|
57
|
-
return false
|
|
58
|
-
}
|
|
59
|
-
const tempIcon = path.join(tempDir, "icon.png")
|
|
60
|
-
if (!isFileExist(tempIcon) || !isPngWithFile(tempIcon)) {
|
|
61
|
-
logger.error("icon 必须是 png 格式")
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
return true
|
|
65
|
-
} finally {
|
|
66
|
-
fs.rmSync(tempDir, { recursive: true })
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
41
|
async getDict() {
|
|
71
42
|
const url = this.baseUrl + "/groups/dict"
|
|
72
43
|
const token = env.get("token")
|
|
@@ -77,7 +48,7 @@ export class PrePublish {
|
|
|
77
48
|
}
|
|
78
49
|
})
|
|
79
50
|
const text = (await res.text()).trim()
|
|
80
|
-
if (!
|
|
51
|
+
if (!Publish.isJSON(text)) {
|
|
81
52
|
logger.error(`parse error: dict resp text not is json`)
|
|
82
53
|
return
|
|
83
54
|
}
|
|
@@ -101,7 +72,7 @@ export class PrePublish {
|
|
|
101
72
|
}
|
|
102
73
|
})
|
|
103
74
|
const text = (await res.text()).trim()
|
|
104
|
-
if (!
|
|
75
|
+
if (!Publish.isJSON(text)) {
|
|
105
76
|
logger.error(`parse error: upload resp text not is json`)
|
|
106
77
|
return
|
|
107
78
|
}
|
|
@@ -115,7 +86,7 @@ export class PrePublish {
|
|
|
115
86
|
* @param {string} changelog
|
|
116
87
|
*/
|
|
117
88
|
async publish(pkgPath, changelog, gid) {
|
|
118
|
-
if (!
|
|
89
|
+
if (!Publish.preCheck(pkgPath)) return
|
|
119
90
|
|
|
120
91
|
await autoLogin()
|
|
121
92
|
|
package/lib/appstore/publish.js
CHANGED
|
@@ -4,7 +4,13 @@ import FormData from "form-data"
|
|
|
4
4
|
import fs from "node:fs"
|
|
5
5
|
import inquirer from "inquirer"
|
|
6
6
|
import path from "node:path"
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
isFileExist,
|
|
9
|
+
isPngWithFile,
|
|
10
|
+
unzipSync,
|
|
11
|
+
loadFromYaml,
|
|
12
|
+
isValidPackageName
|
|
13
|
+
} from "../utils.js"
|
|
8
14
|
|
|
9
15
|
async function askChangeLog() {
|
|
10
16
|
const noEmpty = (value) => value != ""
|
|
@@ -18,6 +24,112 @@ async function askChangeLog() {
|
|
|
18
24
|
])
|
|
19
25
|
}
|
|
20
26
|
|
|
27
|
+
async function getCategories(baseUrl) {
|
|
28
|
+
const response = await request(`${baseUrl}/categories`, { method: "GET" })
|
|
29
|
+
const data = await response.json()
|
|
30
|
+
return data
|
|
31
|
+
.sort((a, b) => a.index - b.index)
|
|
32
|
+
.map((cat) => ({
|
|
33
|
+
name: cat.name,
|
|
34
|
+
value: cat.name
|
|
35
|
+
}))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function askPublishAppInfo(baseUrl, manifest) {
|
|
39
|
+
// 获取分类列表
|
|
40
|
+
const categories = await getCategories(baseUrl)
|
|
41
|
+
|
|
42
|
+
const questions = [
|
|
43
|
+
{
|
|
44
|
+
type: "input",
|
|
45
|
+
name: "name",
|
|
46
|
+
message: "请输入应用名称:",
|
|
47
|
+
default: manifest["name"],
|
|
48
|
+
validate: (input) => (input.trim() !== "" ? true : "应用名称不能为空")
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "input",
|
|
52
|
+
name: "appId",
|
|
53
|
+
message: "请输入应用ID:",
|
|
54
|
+
default: manifest["package"],
|
|
55
|
+
validate: (input) =>
|
|
56
|
+
isValidPackageName(input) ? true : "应用ID不符合规范"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "input",
|
|
60
|
+
name: "description",
|
|
61
|
+
message: "请输入应用描述:",
|
|
62
|
+
default: manifest["description"] || ""
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "input",
|
|
66
|
+
name: "brief",
|
|
67
|
+
message: "请输入应用简介(简单的概述):",
|
|
68
|
+
default: ""
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "checkbox",
|
|
72
|
+
name: "category",
|
|
73
|
+
message: "请选择应用分类:",
|
|
74
|
+
choices: categories,
|
|
75
|
+
validate: (input) => (input.length > 0 ? true : "请至少选择一个分类")
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "input",
|
|
79
|
+
name: "keywords",
|
|
80
|
+
message: "请输入关键词(用逗号分隔):",
|
|
81
|
+
default: ""
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "input",
|
|
85
|
+
name: "source",
|
|
86
|
+
message: "请输入应用来源:",
|
|
87
|
+
default: manifest["homepage"] || ""
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: "input",
|
|
91
|
+
name: "author",
|
|
92
|
+
message: "请输入作者名称:",
|
|
93
|
+
default: manifest["author"] || ""
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
const answers = await inquirer.prompt(questions)
|
|
98
|
+
return answers
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function askWhetherCreateLPK(baseUrl, manifest) {
|
|
102
|
+
const answers = await inquirer.prompt([
|
|
103
|
+
{
|
|
104
|
+
name: "continue",
|
|
105
|
+
type: "input",
|
|
106
|
+
message:
|
|
107
|
+
"检测到您当前的应用,还没有在懒猫微服中创建,是否使用当前的安装包中的信息进行创建? [y/n]",
|
|
108
|
+
default: "y"
|
|
109
|
+
}
|
|
110
|
+
])
|
|
111
|
+
if (answers.continue.toLowerCase() === "y") {
|
|
112
|
+
const appInfo = await askPublishAppInfo(baseUrl, manifest)
|
|
113
|
+
const crateAppRes = await request(`${baseUrl}/apps`, {
|
|
114
|
+
method: "POST",
|
|
115
|
+
body: JSON.stringify(appInfo)
|
|
116
|
+
})
|
|
117
|
+
logger.debug("create app res: ", await crateAppRes.text())
|
|
118
|
+
logger.info(`创建 ${manifest["package"]} 应用成功!`)
|
|
119
|
+
} else {
|
|
120
|
+
logger.info(`当前想发布的应用没有在 '懒猫微服的开发者中心' 创建,请按照以下步骤创建:
|
|
121
|
+
|
|
122
|
+
1. 浏览器打开 https://developer.lazycat.cloud/manage
|
|
123
|
+
2. 登录您的开发者帐号
|
|
124
|
+
3. 登录成功后,您可以查看到您帐号中的应用,同时您也可以对您的应用进行管理
|
|
125
|
+
4. 点击 '新增',根据您的应用信息进行填写
|
|
126
|
+
5. 填写完成后,点击创建即可
|
|
127
|
+
6. 创建成功后,您可以通过 'lzc-cli appstore publish' 来发布应用了
|
|
128
|
+
`)
|
|
129
|
+
process.exit(1)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
21
133
|
export class Publish {
|
|
22
134
|
constructor(baseUrl = "https://developer.lazycat.cloud/api/v2/developer") {
|
|
23
135
|
this.baseUrl = baseUrl
|
|
@@ -26,16 +138,16 @@ export class Publish {
|
|
|
26
138
|
/**
|
|
27
139
|
* @param {string} raw
|
|
28
140
|
*/
|
|
29
|
-
isJSON(raw) {
|
|
141
|
+
static isJSON(raw) {
|
|
30
142
|
const ml = raw.length
|
|
31
143
|
if (ml <= 1) return false
|
|
32
144
|
return raw[0] == "{" && raw[ml - 1] == "}"
|
|
33
145
|
}
|
|
34
146
|
|
|
35
|
-
preCheck(pkgPath) {
|
|
147
|
+
static preCheck(pkgPath) {
|
|
36
148
|
const tempDir = fs.mkdtempSync(".lzc-cli-publish")
|
|
37
149
|
try {
|
|
38
|
-
unzipSync(pkgPath, tempDir)
|
|
150
|
+
unzipSync(pkgPath, tempDir, ["devshell", "icon.png"])
|
|
39
151
|
if (isFileExist(path.join(tempDir, "devshell"))) {
|
|
40
152
|
logger.error(
|
|
41
153
|
"不能发布一个devshell的版本,请重新使用 `lzc-cli project build` 构建"
|
|
@@ -44,7 +156,7 @@ export class Publish {
|
|
|
44
156
|
}
|
|
45
157
|
const tempIcon = path.join(tempDir, "icon.png")
|
|
46
158
|
if (!isFileExist(tempIcon) || !isPngWithFile(tempIcon)) {
|
|
47
|
-
logger.error("icon
|
|
159
|
+
logger.error("icon 必须存在且要求是 png 格式")
|
|
48
160
|
return false
|
|
49
161
|
}
|
|
50
162
|
return true
|
|
@@ -53,12 +165,38 @@ export class Publish {
|
|
|
53
165
|
}
|
|
54
166
|
}
|
|
55
167
|
|
|
168
|
+
async checkAppIdExist(pkgPath) {
|
|
169
|
+
const tempDir = fs.mkdtempSync(".lzc-cli-publish")
|
|
170
|
+
try {
|
|
171
|
+
unzipSync(pkgPath, tempDir, ["manifest.yml"])
|
|
172
|
+
const manifest = loadFromYaml(path.join(tempDir, "manifest.yml"))
|
|
173
|
+
const checkUrl = this.baseUrl + `/apps/${manifest["package"]}/check_exist`
|
|
174
|
+
const res = await request(checkUrl, { method: "GET" })
|
|
175
|
+
if (res.status >= 400) {
|
|
176
|
+
logger.error("检测应用是否存在出错, 错误状态码为: ", res.status)
|
|
177
|
+
logger.error(await res.text())
|
|
178
|
+
return { manifest, appIdExisted: true } // 默认认为已经存在
|
|
179
|
+
} else {
|
|
180
|
+
const text = (await res.text()).trim()
|
|
181
|
+
logger.debug(`check appId[${manifest["package"]}] exist: ${text}`)
|
|
182
|
+
return { manifest, appIdExisted: text == "true" }
|
|
183
|
+
}
|
|
184
|
+
} finally {
|
|
185
|
+
fs.rmSync(tempDir, { recursive: true })
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
56
189
|
/**
|
|
57
190
|
* @param {string} pkgPath
|
|
58
191
|
* @param {string} changelog
|
|
59
192
|
*/
|
|
60
193
|
async publish(pkgPath, changelog) {
|
|
61
|
-
if (!
|
|
194
|
+
if (!Publish.preCheck(pkgPath)) return
|
|
195
|
+
|
|
196
|
+
const { manifest, appIdExisted } = await this.checkAppIdExist(pkgPath)
|
|
197
|
+
if (!appIdExisted) {
|
|
198
|
+
await askWhetherCreateLPK(this.baseUrl, manifest)
|
|
199
|
+
}
|
|
62
200
|
|
|
63
201
|
await autoLogin()
|
|
64
202
|
|
|
@@ -80,7 +218,7 @@ export class Publish {
|
|
|
80
218
|
body: form
|
|
81
219
|
})
|
|
82
220
|
const text = (await res.text()).trim()
|
|
83
|
-
if (!
|
|
221
|
+
if (!Publish.isJSON(text)) {
|
|
84
222
|
logger.info("upload lpk fail", text)
|
|
85
223
|
return
|
|
86
224
|
}
|
package/lib/utils.js
CHANGED
|
@@ -474,14 +474,28 @@ export async function resolveDomain(domain) {
|
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
export function unzipSync(zipPath, destPath) {
|
|
477
|
+
export function unzipSync(zipPath, destPath, entries = []) {
|
|
478
|
+
if (!isFileExist(zipPath)) {
|
|
479
|
+
throw `${zipPath} 找不到该文件`
|
|
480
|
+
}
|
|
481
|
+
|
|
478
482
|
// 确保目标目录存在
|
|
479
483
|
fs.mkdirSync(destPath, { recursive: true })
|
|
480
484
|
// 创建 zip 实例
|
|
481
485
|
const zip = new AdmZip(zipPath)
|
|
482
486
|
|
|
483
|
-
|
|
484
|
-
|
|
487
|
+
if (entries.length > 0) {
|
|
488
|
+
entries.forEach((entry) => {
|
|
489
|
+
try {
|
|
490
|
+
zip.extractEntryTo(entry, destPath, false, true)
|
|
491
|
+
} catch {
|
|
492
|
+
logger.debug(`压缩包中没有找到 ${entry} 文件`)
|
|
493
|
+
}
|
|
494
|
+
})
|
|
495
|
+
} else {
|
|
496
|
+
// 同步解压所有文件
|
|
497
|
+
zip.extractAllTo(destPath, true)
|
|
498
|
+
}
|
|
485
499
|
}
|
|
486
500
|
|
|
487
501
|
export function findSshPublicKey() {
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.43",
|
|
4
4
|
"description": "lazycat cloud developer kit",
|
|
5
5
|
"files": [
|
|
6
6
|
"template",
|
|
7
7
|
"scripts",
|
|
8
|
-
"lib"
|
|
8
|
+
"lib",
|
|
9
|
+
"changelog.md"
|
|
9
10
|
],
|
|
10
11
|
"bin": {
|
|
11
12
|
"lzc-cli": "./scripts/cli.js"
|
package/scripts/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ import env from "../lib/env.js"
|
|
|
19
19
|
// logger level middleware
|
|
20
20
|
const logLevelOriginalFactory = logger.methodFactory
|
|
21
21
|
logger.methodFactory = function (methodName, logLevel, loggerName) {
|
|
22
|
+
let debug = logLevel <= logger.levels.DEBUG
|
|
22
23
|
let rawMethod = logLevelOriginalFactory(methodName, logLevel, loggerName)
|
|
23
24
|
return function (...args) {
|
|
24
25
|
let color = (msg) => chalk.gray
|
|
@@ -41,7 +42,7 @@ logger.methodFactory = function (methodName, logLevel, loggerName) {
|
|
|
41
42
|
}
|
|
42
43
|
const prefix = loggerName ?? methodName
|
|
43
44
|
rawMethod(
|
|
44
|
-
`[${prefix}] ` +
|
|
45
|
+
(debug ? `[${prefix}] ` : "") +
|
|
45
46
|
args
|
|
46
47
|
.map((a) => {
|
|
47
48
|
let res = a
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
node_modules
|
|
3
|
+
dist
|
|
4
|
+
*.lpk
|
|
5
|
+
|
|
6
|
+
# local env files
|
|
7
|
+
.env.local
|
|
8
|
+
.env.*.local
|
|
9
|
+
|
|
10
|
+
# Log files
|
|
11
|
+
npm-debug.log*
|
|
12
|
+
yarn-debug.log*
|
|
13
|
+
yarn-error.log*
|
|
14
|
+
pnpm-debug.log*
|
|
15
|
+
|
|
16
|
+
# Editor directories and files
|
|
17
|
+
.idea
|
|
18
|
+
.vscode
|
|
19
|
+
*.suo
|
|
20
|
+
*.ntvs*
|
|
21
|
+
*.njsproj
|
|
22
|
+
*.sln
|
|
23
|
+
*.sw?
|
|
24
|
+
.temp
|
|
25
|
+
.cache
|