@cnbcool/cnb-api-generate 2.1.1 → 2.2.0
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.
|
@@ -24,10 +24,8 @@ export function getToolParamDefs(moduleName: string, toolName: string) {
|
|
|
24
24
|
export function formatParams(
|
|
25
25
|
params: Record<string, string | string[] | boolean | undefined>,
|
|
26
26
|
): Record<string, any> {
|
|
27
|
-
console.log(JSON.stringify(params))
|
|
28
27
|
// 先将 CLI 带 '-' 的参数名还原为原始 '_'/'@' 参数名
|
|
29
28
|
params = restoreOriginalKeys(params);
|
|
30
|
-
console.log(params)
|
|
31
29
|
const formatted: Record<string, any> = {
|
|
32
30
|
module: params.module,
|
|
33
31
|
tool: params.tool,
|
package/client/lib/print-json.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { encode } from '@toon-format/toon'
|
|
1
2
|
/**
|
|
2
3
|
* 将数据转换为格式化的 JSON 字符串
|
|
3
4
|
* @param data 要序列化的数据(可以是任意类型)缩进)
|
|
@@ -8,5 +9,13 @@ export function printJSON(
|
|
|
8
9
|
data: Record<string, any> | Array<any>,
|
|
9
10
|
verbose: boolean = false
|
|
10
11
|
): string {
|
|
11
|
-
|
|
12
|
+
if (verbose) {
|
|
13
|
+
return JSON.stringify(data, null, 2);
|
|
14
|
+
} else {
|
|
15
|
+
try {
|
|
16
|
+
return encode(data);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return JSON.stringify(data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnbcool/cnb-api-generate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"main": "./built/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@babel/preset-env": "^7.29.0",
|
|
34
34
|
"@babel/preset-typescript": "^7.28.5",
|
|
35
35
|
"@babel/traverse": "^7.29.0",
|
|
36
|
+
"@toon-format/toon": "^2.1.0",
|
|
36
37
|
"@types/cli-progress": "^3.11.6",
|
|
37
38
|
"@types/lodash": "4.17.20",
|
|
38
39
|
"babel-plugin-transform-define": "^2.1.4",
|