td-web-cli 0.1.6 → 0.1.8
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/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/interface.d.ts +6 -0
- package/dist/api/interface.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/modules/i18n/excel2json/index.d.ts +9 -0
- package/dist/modules/i18n/excel2json/index.d.ts.map +1 -0
- package/dist/modules/i18n/excel2json/index.js +10 -11
- package/dist/modules/i18n/extractEntry/index.d.ts +2 -0
- package/dist/modules/i18n/extractEntry/index.d.ts.map +1 -0
- package/dist/modules/i18n/index.d.ts +8 -0
- package/dist/modules/i18n/index.d.ts.map +1 -0
- package/dist/modules/i18n/json2excel/index.d.ts +2 -0
- package/dist/modules/i18n/json2excel/index.d.ts.map +1 -0
- package/dist/modules/i18n/jsonMerge/index.d.ts +2 -0
- package/dist/modules/i18n/jsonMerge/index.d.ts.map +1 -0
- package/dist/utils/index.d.ts +151 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +4 -1
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/logs/20260127.txt +0 -150
- package/setting.json +0 -47
- package/src/api/index.ts +0 -188
- package/src/api/interface.ts +0 -6
- package/src/index.ts +0 -78
- package/src/modules/i18n/excel2json/index.ts +0 -513
- package/src/modules/i18n/extractEntry/index.ts +0 -3
- package/src/modules/i18n/index.ts +0 -78
- package/src/modules/i18n/json2excel/index.ts +0 -3
- package/src/modules/i18n/jsonMerge/index.ts +0 -3
- package/src/utils/index.ts +0 -367
- package/tsconfig.json +0 -12
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getData: <T>(url: string, params?: Record<string, unknown>, headers?: Record<string, string>) => Promise<T>;
|
|
2
|
+
export declare const postData: <T, R>(url: string, params: T, headers?: Record<string, string>) => Promise<R>;
|
|
3
|
+
export declare const postStream: <T>(url: string, params: T, headers: Record<string, string> | undefined, onData: (chunk: string) => void, onError?: (error: Error) => void, onComplete?: () => void, signal?: AbortSignal) => Promise<void>;
|
|
4
|
+
export declare const postSSE: <T>(url: string, params: T, headers: Record<string, string> | undefined, onMessage: (event: string, data: string) => void, onError?: (error: Error) => void, signal?: AbortSignal) => Promise<void>;
|
|
5
|
+
export declare const putData: <T, R>(url: string, params: T, headers?: Record<string, string>) => Promise<R>;
|
|
6
|
+
export declare const deleteData: <T>(url: string, params?: Record<string, unknown>, headers?: Record<string, string>) => Promise<T>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,GAAU,CAAC,EAC7B,KAAK,MAAM,EACX,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KACnC,OAAO,CAAC,CAAC,CAGX,CAAC;AAGF,eAAO,MAAM,QAAQ,GAAU,CAAC,EAAE,CAAC,EACjC,KAAK,MAAM,EACX,QAAQ,CAAC,EACT,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KACnC,OAAO,CAAC,CAAC,CAKX,CAAC;AAGF,eAAO,MAAM,UAAU,GAAU,CAAC,EAChC,KAAK,MAAM,EACX,QAAQ,CAAC,EACT,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAK,EACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAC/B,UAAU,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,aAAa,MAAM,IAAI,EACvB,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAwDd,CAAC;AAGF,eAAO,MAAM,OAAO,GAAU,CAAC,EAC7B,KAAK,MAAM,EACX,QAAQ,CAAC,EACT,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAK,EACpC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,EAChD,UAAU,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAiEd,CAAC;AAGF,eAAO,MAAM,OAAO,GAAU,CAAC,EAAE,CAAC,EAChC,KAAK,MAAM,EACX,QAAQ,CAAC,EACT,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KACnC,OAAO,CAAC,CAAC,CAKX,CAAC;AAGF,eAAO,MAAM,UAAU,GAAU,CAAC,EAChC,KAAK,MAAM,EACX,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,UAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KACnC,OAAO,CAAC,CAAC,CAGX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG;;;CAGR,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* excel转json功能主函数
|
|
4
|
+
* 读取用户输入的excel路径,解析内容,根据配置生成多语言json文件
|
|
5
|
+
* 并对配置文件中所有语言对应的词条进行语言检测
|
|
6
|
+
* @param program Commander命令行实例
|
|
7
|
+
*/
|
|
8
|
+
export declare function excel2json(program: Command): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/i18n/excel2json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyLpC;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,iBA8ThD"}
|
|
@@ -278,7 +278,7 @@ export async function excel2json(program) {
|
|
|
278
278
|
langKeysMap[langKey].push(valStr);
|
|
279
279
|
}
|
|
280
280
|
else {
|
|
281
|
-
//
|
|
281
|
+
// 确保检测结果数组长度一致,填空字符串
|
|
282
282
|
langKeysMap[langKey].push('');
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -293,27 +293,25 @@ export async function excel2json(program) {
|
|
|
293
293
|
if (!longCode) {
|
|
294
294
|
logger.warn(`语言(${langKey})未配置 longCode,跳过检测`, true);
|
|
295
295
|
langCheckErrorsMap[langKey] =
|
|
296
|
-
texts.length > 0
|
|
297
|
-
? texts.map(() => '未配置 longCode,未进行检测')
|
|
298
|
-
: ['无词条'];
|
|
296
|
+
texts.length > 0 ? texts.map(() => '') : [];
|
|
299
297
|
continue;
|
|
300
298
|
}
|
|
301
299
|
if (texts.length === 0) {
|
|
302
300
|
logger.info(`语言(${langKey})无词条,跳过检测`, true);
|
|
303
|
-
langCheckErrorsMap[langKey] = [
|
|
301
|
+
langCheckErrorsMap[langKey] = [];
|
|
304
302
|
continue;
|
|
305
303
|
}
|
|
306
304
|
logger.info(`开始对语言(${langKey})词条进行语言检测,词条数量:${texts.length} (${idx + 1}/${langKeysEntries.length})`, true);
|
|
307
305
|
const checkResults = await batchCheckTexts(texts, longCode);
|
|
308
306
|
if (!checkResults || checkResults.length === 0 || !checkResults[0]) {
|
|
309
307
|
logger.error(`语言(${langKey})词条检测失败`, true);
|
|
310
|
-
langCheckErrorsMap[langKey] = texts.map(() => '
|
|
308
|
+
langCheckErrorsMap[langKey] = texts.map(() => '');
|
|
311
309
|
continue;
|
|
312
310
|
}
|
|
313
311
|
const result = checkResults[0];
|
|
314
312
|
if (result.matches.length === 0) {
|
|
315
313
|
logger.info(`语言(${langKey})词条检测无错误`, true);
|
|
316
|
-
langCheckErrorsMap[langKey] = texts.map(() => '
|
|
314
|
+
langCheckErrorsMap[langKey] = texts.map(() => '');
|
|
317
315
|
}
|
|
318
316
|
else {
|
|
319
317
|
logger.info(`语言(${langKey})词条检测发现问题,词条数量: ${result.matches.length}`, true);
|
|
@@ -368,21 +366,22 @@ export async function excel2json(program) {
|
|
|
368
366
|
});
|
|
369
367
|
// 构造检测结果excel的内容,每一列对应语言检测错误描述
|
|
370
368
|
// 每行对应原excel中一条数据行
|
|
371
|
-
const errorSheetData = [errorSheetHeader];
|
|
372
|
-
// 数据行数(不包括表头)
|
|
373
369
|
const dataRowCount = rows.length - 1;
|
|
370
|
+
const errorSheetData = [errorSheetHeader];
|
|
374
371
|
for (let i = 0; i < dataRowCount; i++) {
|
|
375
372
|
const rowErrors = [];
|
|
376
373
|
// 按列索引顺序遍历,填充对应语言的检测错误
|
|
377
374
|
Object.entries(colIndexToLangKey)
|
|
378
375
|
.sort((a, b) => Number(a[0]) - Number(b[0]))
|
|
379
376
|
.forEach(([colIdxStr, langKey]) => {
|
|
377
|
+
var _a;
|
|
380
378
|
const errorsArr = langCheckErrorsMap[langKey];
|
|
381
379
|
if (errorsArr && errorsArr.length > i) {
|
|
382
|
-
|
|
380
|
+
// 只展示检测错误,空字符串视为空白
|
|
381
|
+
const err = (_a = errorsArr[i]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
382
|
+
rowErrors.push(err && err.length > 0 ? err : '');
|
|
383
383
|
}
|
|
384
384
|
else {
|
|
385
|
-
// 可能某些语言词条数量不足时,填空
|
|
386
385
|
rowErrors.push('');
|
|
387
386
|
}
|
|
388
387
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/i18n/extractEntry/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,SAElB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,iBAmE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/i18n/json2excel/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,SAElB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/i18n/jsonMerge/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,SAElB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取当前时间戳字符串,格式为:YYYYMMDDHHMMSS
|
|
3
|
+
* 例如:20260123135500 表示 2026年01月23日 13点55分00秒
|
|
4
|
+
*
|
|
5
|
+
* @returns {string} 格式化后的时间戳字符串
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTimestamp(): string;
|
|
8
|
+
/**
|
|
9
|
+
* 日志级别类型
|
|
10
|
+
*/
|
|
11
|
+
type LogLevel = 'INFO' | 'WARN' | 'ERROR';
|
|
12
|
+
/**
|
|
13
|
+
* 日志配置接口
|
|
14
|
+
*/
|
|
15
|
+
interface LoggerOptions {
|
|
16
|
+
/**
|
|
17
|
+
* 日志目录,默认根目录下的 logs 文件夹
|
|
18
|
+
*/
|
|
19
|
+
logsDir?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 日志文件名格式函数,接收当前日期,返回文件名字符串
|
|
22
|
+
* 默认格式为 YYYYMMDD.txt
|
|
23
|
+
*/
|
|
24
|
+
filenameFormatter?: (date: Date) => string;
|
|
25
|
+
/**
|
|
26
|
+
* 当前环境,默认 process.env.NODE_ENV
|
|
27
|
+
*/
|
|
28
|
+
env?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 统一日志处理类
|
|
32
|
+
* 支持写入日志文件和控制台打印
|
|
33
|
+
*/
|
|
34
|
+
export declare class Logger {
|
|
35
|
+
private logsDir;
|
|
36
|
+
private filenameFormatter;
|
|
37
|
+
private env;
|
|
38
|
+
/**
|
|
39
|
+
* 构造函数,初始化日志配置
|
|
40
|
+
* @param options 配置项,可选
|
|
41
|
+
*/
|
|
42
|
+
constructor(options?: LoggerOptions);
|
|
43
|
+
/**
|
|
44
|
+
* 写日志主函数
|
|
45
|
+
* @param level 日志级别
|
|
46
|
+
* @param message 日志内容,支持字符串或对象
|
|
47
|
+
* @param printConsole 是否打印到控制台,默认 false
|
|
48
|
+
*/
|
|
49
|
+
log(level: LogLevel, message: unknown, printConsole?: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* 记录信息级别日志
|
|
52
|
+
* @param message 日志内容
|
|
53
|
+
* @param printConsole 是否打印到控制台,默认 false
|
|
54
|
+
*/
|
|
55
|
+
info(message: unknown, printConsole?: boolean): void;
|
|
56
|
+
/**
|
|
57
|
+
* 记录警告级别日志
|
|
58
|
+
* @param message 日志内容
|
|
59
|
+
* @param printConsole 是否打印到控制台,默认 false
|
|
60
|
+
*/
|
|
61
|
+
warn(message: unknown, printConsole?: boolean): void;
|
|
62
|
+
/**
|
|
63
|
+
* 记录错误级别日志
|
|
64
|
+
* @param message 日志内容
|
|
65
|
+
* @param printConsole 是否打印到控制台,默认 false
|
|
66
|
+
*/
|
|
67
|
+
error(message: unknown, printConsole?: boolean): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 默认导出单例 logger,方便直接使用
|
|
71
|
+
* 默认不打印控制台日志
|
|
72
|
+
*/
|
|
73
|
+
export declare const logger: Logger;
|
|
74
|
+
/**
|
|
75
|
+
* 通用错误日志记录函数
|
|
76
|
+
* @param error 捕获的错误对象
|
|
77
|
+
* @param logger 日志对象,需包含 error 方法
|
|
78
|
+
* @param prefix 日志前缀,方便区分来源,默认值为 '程序执行时发生错误'
|
|
79
|
+
* @param printConsole 是否打印错误日志到控制台,默认 false
|
|
80
|
+
*/
|
|
81
|
+
export declare function loggerError(error: unknown, logger: {
|
|
82
|
+
error: (msg: string, printConsole?: boolean) => void;
|
|
83
|
+
}, prefix?: string, printConsole?: boolean): void;
|
|
84
|
+
/**
|
|
85
|
+
* 将任意错误对象规范化为 Error 类型。
|
|
86
|
+
* @param err - 可能是 Error、字符串或其他任意类型
|
|
87
|
+
* @returns 标准的 Error 对象
|
|
88
|
+
*/
|
|
89
|
+
export declare const normalizeError: (err: unknown) => Error;
|
|
90
|
+
/**
|
|
91
|
+
* 语言工具接口返回的语言列表类型
|
|
92
|
+
* 数组中每个元素包含语言名称、简写代码和长代码
|
|
93
|
+
*/
|
|
94
|
+
export type LanguageTool = {
|
|
95
|
+
name: string;
|
|
96
|
+
code: string;
|
|
97
|
+
longCode: string;
|
|
98
|
+
}[];
|
|
99
|
+
/**
|
|
100
|
+
* 获取支持的语言列表
|
|
101
|
+
* 调用语言工具接口,返回所有支持的语言信息数组
|
|
102
|
+
* @returns Promise<LanguageTool> 返回语言列表的 Promise
|
|
103
|
+
* @throws 接口请求失败时抛出错误,错误信息包含接口地址和异常堆栈
|
|
104
|
+
*/
|
|
105
|
+
export declare function getLanguageTool(): Promise<LanguageTool>;
|
|
106
|
+
/**
|
|
107
|
+
* 替换建议类型
|
|
108
|
+
*/
|
|
109
|
+
export interface Replacement {
|
|
110
|
+
value: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 语言检测结果中的单条匹配错误信息
|
|
114
|
+
*/
|
|
115
|
+
export interface Match {
|
|
116
|
+
message: string;
|
|
117
|
+
shortMessage: string;
|
|
118
|
+
offset: number;
|
|
119
|
+
length: number;
|
|
120
|
+
replacements: Replacement[];
|
|
121
|
+
sentence: string;
|
|
122
|
+
rule: {
|
|
123
|
+
id: string;
|
|
124
|
+
description: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 语言检测接口返回的完整结果类型
|
|
129
|
+
*/
|
|
130
|
+
export interface CheckResult {
|
|
131
|
+
matches: Match[];
|
|
132
|
+
language: {
|
|
133
|
+
name: string;
|
|
134
|
+
code: string;
|
|
135
|
+
};
|
|
136
|
+
software: {
|
|
137
|
+
name: string;
|
|
138
|
+
version: string;
|
|
139
|
+
premium: boolean;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 调用语言检测接口,检测文本中的语言错误
|
|
144
|
+
* @param text 待检测文本
|
|
145
|
+
* @param language 语言代码,默认 'en-US'
|
|
146
|
+
* @returns Promise<CheckResult> 返回检测结果的 Promise
|
|
147
|
+
* @throws 接口请求失败时抛出错误,错误信息包含接口地址和异常堆栈
|
|
148
|
+
*/
|
|
149
|
+
export declare function languageToolCheck(text: string, language?: string): Promise<CheckResult>;
|
|
150
|
+
export {};
|
|
151
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAmBrC;AAED;;GAEG;AACH,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,UAAU,aAAa;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAE3C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA8ED;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,GAAG,CAAS;IAEpB;;;OAGG;gBACS,OAAO,CAAC,EAAE,aAAa;IAUnC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,IAAI;IAsClE;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,IAAI;IAIlD;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,IAAI;IAIlD;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,IAAI;CAGpD;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,QAEjB,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,EAChE,MAAM,SAAc,EACpB,YAAY,UAAQ,GACnB,IAAI,CAEN;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,OAAO,KAAG,KAW7C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,EAAE,CAAC;AAEJ;;;;;GAKG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAS7D;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QAEJ,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,QAAQ,EAAE;QAER,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,QAAQ,EAAE;QAER,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,SAAU,GACjB,OAAO,CAAC,WAAW,CAAC,CAetB"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "td-web-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A CLI tool for efficiency",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"td-web-cli": "dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "tsc",
|
|
12
15
|
"format": "prettier --write \"src/**/*.{js,ts,tsx,json,md}\""
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/logs/20260127.txt
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
[2026-01-27T15:35:46+08:00] [INFO] td-web-cli程序启动
|
|
2
|
-
[2026-01-27T15:35:46+08:00] [INFO] 命令行参数解析完成:
|
|
3
|
-
[2026-01-27T15:35:59+08:00] [INFO] 用户选择模块:国际化
|
|
4
|
-
[2026-01-27T15:35:59+08:00] [INFO] 国际化模块开始执行
|
|
5
|
-
[2026-01-27T15:35:59+08:00] [INFO] 国际化模块启动,等待用户选择功能
|
|
6
|
-
[2026-01-27T15:36:01+08:00] [INFO] 用户选择功能:excel转json
|
|
7
|
-
[2026-01-27T15:36:01+08:00] [INFO] excel转json功能开始执行
|
|
8
|
-
[2026-01-27T15:36:01+08:00] [INFO] 开始加载配置文件:D:\person\code\td-web-cli\setting.json
|
|
9
|
-
[2026-01-27T15:36:01+08:00] [INFO] 配置文件加载成功
|
|
10
|
-
[2026-01-27T15:36:01+08:00] [INFO] 尝试获取在线支持的语言列表...
|
|
11
|
-
[2026-01-27T15:36:03+08:00] [INFO] 成功获取语言列表,覆盖配置文件中的 longCodes
|
|
12
|
-
[2026-01-27T15:36:11+08:00] [INFO] 开始读取excel文件:d:\test\词条\A9-V4-CTC01翻译词条-20251215 - 副本.xlsx
|
|
13
|
-
[2026-01-27T15:36:11+08:00] [INFO] 开始解析表头
|
|
14
|
-
[2026-01-27T15:36:11+08:00] [INFO] 开始解析数据行
|
|
15
|
-
[2026-01-27T15:36:11+08:00] [INFO] 开始对语言(cn)词条进行语言检测,词条数量:12
|
|
16
|
-
[2026-01-27T15:36:12+08:00] [INFO] 语言(cn)词条检测无错误
|
|
17
|
-
[2026-01-27T15:36:12+08:00] [INFO] 开始对语言(en)词条进行语言检测,词条数量:12
|
|
18
|
-
[2026-01-27T15:36:13+08:00] [INFO] 语言(en)词条检测发现问题,词条数量: 4
|
|
19
|
-
[2026-01-27T15:36:13+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
20
|
-
出错句子: Enjoy your new WiFi network!
|
|
21
|
-
建议替换: Wi-Fi
|
|
22
|
-
[2026-01-27T15:36:13+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
23
|
-
出错句子: The old WiFi network has been disconnected.
|
|
24
|
-
建议替换: Wi-Fi
|
|
25
|
-
[2026-01-27T15:36:13+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
26
|
-
出错句子: To access the setup page again, please connect to your new WiFi network.
|
|
27
|
-
建议替换: Wi-Fi
|
|
28
|
-
[2026-01-27T15:36:13+08:00] [INFO] - 错误: Possible spelling mistake found.
|
|
29
|
-
出错句子: Return to Login
|
|
30
|
-
BrosTrend N300 Wi-Fi to Ethernet Adapter
|
|
31
|
-
Applying settings...
|
|
32
|
-
建议替换: Bros Trend
|
|
33
|
-
[2026-01-27T15:36:13+08:00] [INFO] 开始对语言(zh)词条进行语言检测,词条数量:12
|
|
34
|
-
[2026-01-27T15:36:14+08:00] [ERROR] 程序执行时发生错误:Error: https://api.languagetool.org/v2/check接口报错:AxiosError: Request failed with status code 400
|
|
35
|
-
at settle (file:///D:/person/code/td-web-cli/node_modules/axios/lib/core/settle.js:19:12)
|
|
36
|
-
at IncomingMessage.handleStreamEnd (file:///D:/person/code/td-web-cli/node_modules/axios/lib/adapters/http.js:798:11)
|
|
37
|
-
at IncomingMessage.emit (node:events:530:35)
|
|
38
|
-
at endReadableNT (node:internal/streams/readable:1698:12)
|
|
39
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
|
|
40
|
-
at Axios.request (file:///D:/person/code/td-web-cli/node_modules/axios/lib/core/Axios.js:45:41)
|
|
41
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
|
42
|
-
at async postData (file:///D:/person/code/td-web-cli/dist/api/index.js:10:17)
|
|
43
|
-
at async languageToolCheck (file:///D:/person/code/td-web-cli/dist/utils/index.js:246:21)
|
|
44
|
-
at async batchCheckTexts (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:89:21)
|
|
45
|
-
at async excel2json (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:304:34)
|
|
46
|
-
at async i18n (file:///D:/person/code/td-web-cli/dist/modules/i18n/index.js:57:17)
|
|
47
|
-
at async main (file:///D:/person/code/td-web-cli/dist/index.js:51:17)
|
|
48
|
-
at languageToolCheck (file:///D:/person/code/td-web-cli/dist/utils/index.js:253:15)
|
|
49
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
|
50
|
-
at async batchCheckTexts (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:89:21)
|
|
51
|
-
at async excel2json (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:304:34)
|
|
52
|
-
at async i18n (file:///D:/person/code/td-web-cli/dist/modules/i18n/index.js:57:17)
|
|
53
|
-
at async main (file:///D:/person/code/td-web-cli/dist/index.js:51:17)
|
|
54
|
-
[2026-01-27T15:36:14+08:00] [ERROR] 语言(zh)词条检测失败
|
|
55
|
-
[2026-01-27T15:36:14+08:00] [INFO] 开始对语言(uk)词条进行语言检测,词条数量:12
|
|
56
|
-
[2026-01-27T15:36:16+08:00] [INFO] 语言(uk)词条检测发现问题,词条数量: 3
|
|
57
|
-
[2026-01-27T15:36:16+08:00] [INFO] - 错误: «Підключіть» — нерекомендоване слово, кращий варіант: увімкнути, під'єднати, приєднати.
|
|
58
|
-
出错句子: Підключіть точку доступу до вашого роутера або активного порту Ethernet за допомогою кабелю Ethernet.
|
|
59
|
-
建议替换: Увімкнути, Під'єднати, Приєднати
|
|
60
|
-
[2026-01-27T15:36:16+08:00] [INFO] - 错误: «підключіться» — нерекомендоване слово, кращий варіант: увімкнутися, під'єднатися, приєднатися.
|
|
61
|
-
出错句子: Щоб знову отримати доступ до сторінки налаштувань, підключіться до своєї нової мережі WiFi.
|
|
62
|
-
建议替换: увімкнутися, під'єднатися, приєднатися
|
|
63
|
-
[2026-01-27T15:36:16+08:00] [INFO] - 错误: «веб-інтерфейс» — написання не відповідає чинній версії правопису, виправлення: вебінтерфейс.
|
|
64
|
-
出错句子: Після скидання пристрою відвідайте http://brostrendwifi.com для входу в веб-інтерфейс.
|
|
65
|
-
建议替换: вебінтерфейс
|
|
66
|
-
[2026-01-27T15:36:16+08:00] [INFO] 开始生成语言文件,输出目录:d:\test\词条\lang_20260127153616
|
|
67
|
-
[2026-01-27T15:36:16+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127153616\cn\translate.json
|
|
68
|
-
[2026-01-27T15:36:16+08:00] [INFO] 跳过默认语言(en)的json文件生成
|
|
69
|
-
[2026-01-27T15:36:16+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127153616\zh\translate.json
|
|
70
|
-
[2026-01-27T15:36:16+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127153616\uk\translate.json
|
|
71
|
-
[2026-01-27T15:36:16+08:00] [INFO] 开始生成语言检测结果excel文件
|
|
72
|
-
[2026-01-27T15:36:16+08:00] [INFO] 语言检测结果excel文件已生成:d:\test\词条\lang_20260127153616\lang_check_results.xlsx
|
|
73
|
-
[2026-01-27T15:36:16+08:00] [INFO] 全部转换完成,语言文件输出目录:d:\test\词条\lang_20260127153616
|
|
74
|
-
[2026-01-27T15:36:16+08:00] [INFO] excel转json功能执行完成
|
|
75
|
-
[2026-01-27T15:36:16+08:00] [INFO] 国际化模块执行完成
|
|
76
|
-
[2026-01-27T16:26:38+08:00] [INFO] td-web-cli程序启动
|
|
77
|
-
[2026-01-27T16:26:38+08:00] [INFO] 命令行参数解析完成:
|
|
78
|
-
[2026-01-27T16:26:41+08:00] [INFO] 用户选择模块:国际化
|
|
79
|
-
[2026-01-27T16:26:41+08:00] [INFO] 国际化模块开始执行
|
|
80
|
-
[2026-01-27T16:26:41+08:00] [INFO] 国际化模块启动,等待用户选择功能
|
|
81
|
-
[2026-01-27T16:26:42+08:00] [INFO] 用户选择功能:excel转json
|
|
82
|
-
[2026-01-27T16:26:42+08:00] [INFO] excel转json功能开始执行
|
|
83
|
-
[2026-01-27T16:26:42+08:00] [INFO] 开始加载配置文件:D:\person\code\td-web-cli\setting.json
|
|
84
|
-
[2026-01-27T16:26:42+08:00] [INFO] 配置文件加载成功
|
|
85
|
-
[2026-01-27T16:26:42+08:00] [INFO] 尝试获取在线支持的语言列表...
|
|
86
|
-
[2026-01-27T16:26:44+08:00] [INFO] 成功获取语言列表,覆盖配置文件中的 longCodes
|
|
87
|
-
[2026-01-27T16:26:49+08:00] [INFO] 开始读取excel文件:d:\test\词条\A9-V4-CTC01翻译词条-20251215 - 副本.xlsx
|
|
88
|
-
[2026-01-27T16:26:49+08:00] [INFO] 开始解析表头
|
|
89
|
-
[2026-01-27T16:26:49+08:00] [INFO] 开始解析数据行
|
|
90
|
-
[2026-01-27T16:26:49+08:00] [INFO] 开始对语言(cn)词条进行语言检测,词条数量:12 (1/4)
|
|
91
|
-
[2026-01-27T16:26:50+08:00] [INFO] 语言(cn)词条检测无错误
|
|
92
|
-
[2026-01-27T16:26:50+08:00] [INFO] 开始对语言(en)词条进行语言检测,词条数量:12 (2/4)
|
|
93
|
-
[2026-01-27T16:26:51+08:00] [INFO] 语言(en)词条检测发现问题,词条数量: 4
|
|
94
|
-
[2026-01-27T16:26:51+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
95
|
-
出错句子: Enjoy your new WiFi network!
|
|
96
|
-
建议替换: Wi-Fi
|
|
97
|
-
[2026-01-27T16:26:51+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
98
|
-
出错句子: The old WiFi network has been disconnected.
|
|
99
|
-
建议替换: Wi-Fi
|
|
100
|
-
[2026-01-27T16:26:51+08:00] [INFO] - 错误: Did you mean “Wi-Fi”? (This is the officially approved term by the Wi-Fi Alliance.)
|
|
101
|
-
出错句子: To access the setup page again, please connect to your new WiFi network.
|
|
102
|
-
建议替换: Wi-Fi
|
|
103
|
-
[2026-01-27T16:26:51+08:00] [INFO] - 错误: Possible spelling mistake found.
|
|
104
|
-
出错句子: Return to Login
|
|
105
|
-
BrosTrend N300 Wi-Fi to Ethernet Adapter
|
|
106
|
-
Applying settings...
|
|
107
|
-
建议替换: Bros Trend
|
|
108
|
-
[2026-01-27T16:26:51+08:00] [INFO] 开始对语言(zh)词条进行语言检测,词条数量:12 (3/4)
|
|
109
|
-
[2026-01-27T16:26:51+08:00] [ERROR] 程序执行时发生错误:Error: https://api.languagetool.org/v2/check接口报错:AxiosError: Request failed with status code 400
|
|
110
|
-
at settle (file:///D:/person/code/td-web-cli/node_modules/axios/lib/core/settle.js:19:12)
|
|
111
|
-
at IncomingMessage.handleStreamEnd (file:///D:/person/code/td-web-cli/node_modules/axios/lib/adapters/http.js:798:11)
|
|
112
|
-
at IncomingMessage.emit (node:events:530:35)
|
|
113
|
-
at endReadableNT (node:internal/streams/readable:1698:12)
|
|
114
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
|
|
115
|
-
at Axios.request (file:///D:/person/code/td-web-cli/node_modules/axios/lib/core/Axios.js:45:41)
|
|
116
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
|
117
|
-
at async postData (file:///D:/person/code/td-web-cli/dist/api/index.js:10:17)
|
|
118
|
-
at async languageToolCheck (file:///D:/person/code/td-web-cli/dist/utils/index.js:246:21)
|
|
119
|
-
at async batchCheckTexts (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:89:21)
|
|
120
|
-
at async excel2json (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:307:34)
|
|
121
|
-
at async i18n (file:///D:/person/code/td-web-cli/dist/modules/i18n/index.js:57:17)
|
|
122
|
-
at async main (file:///D:/person/code/td-web-cli/dist/index.js:51:17)
|
|
123
|
-
at languageToolCheck (file:///D:/person/code/td-web-cli/dist/utils/index.js:253:15)
|
|
124
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
|
125
|
-
at async batchCheckTexts (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:89:21)
|
|
126
|
-
at async excel2json (file:///D:/person/code/td-web-cli/dist/modules/i18n/excel2json/index.js:307:34)
|
|
127
|
-
at async i18n (file:///D:/person/code/td-web-cli/dist/modules/i18n/index.js:57:17)
|
|
128
|
-
at async main (file:///D:/person/code/td-web-cli/dist/index.js:51:17)
|
|
129
|
-
[2026-01-27T16:26:51+08:00] [ERROR] 语言(zh)词条检测失败
|
|
130
|
-
[2026-01-27T16:26:51+08:00] [INFO] 开始对语言(uk)词条进行语言检测,词条数量:12 (4/4)
|
|
131
|
-
[2026-01-27T16:26:53+08:00] [INFO] 语言(uk)词条检测发现问题,词条数量: 3
|
|
132
|
-
[2026-01-27T16:26:53+08:00] [INFO] - 错误: «Підключіть» — нерекомендоване слово, кращий варіант: увімкнути, під'єднати, приєднати.
|
|
133
|
-
出错句子: Підключіть точку доступу до вашого роутера або активного порту Ethernet за допомогою кабелю Ethernet.
|
|
134
|
-
建议替换: Увімкнути, Під'єднати, Приєднати
|
|
135
|
-
[2026-01-27T16:26:53+08:00] [INFO] - 错误: «підключіться» — нерекомендоване слово, кращий варіант: увімкнутися, під'єднатися, приєднатися.
|
|
136
|
-
出错句子: Щоб знову отримати доступ до сторінки налаштувань, підключіться до своєї нової мережі WiFi.
|
|
137
|
-
建议替换: увімкнутися, під'єднатися, приєднатися
|
|
138
|
-
[2026-01-27T16:26:53+08:00] [INFO] - 错误: «веб-інтерфейс» — написання не відповідає чинній версії правопису, виправлення: вебінтерфейс.
|
|
139
|
-
出错句子: Після скидання пристрою відвідайте http://brostrendwifi.com для входу в веб-інтерфейс.
|
|
140
|
-
建议替换: вебінтерфейс
|
|
141
|
-
[2026-01-27T16:26:53+08:00] [INFO] 开始生成语言文件,输出目录:d:\test\词条\lang_20260127162653
|
|
142
|
-
[2026-01-27T16:26:53+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127162653\cn\translate.json
|
|
143
|
-
[2026-01-27T16:26:53+08:00] [INFO] 跳过默认语言(en)的json文件生成
|
|
144
|
-
[2026-01-27T16:26:53+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127162653\zh\translate.json
|
|
145
|
-
[2026-01-27T16:26:53+08:00] [INFO] 已生成语言文件:d:\test\词条\lang_20260127162653\uk\translate.json
|
|
146
|
-
[2026-01-27T16:26:53+08:00] [INFO] 开始生成语言检测结果excel文件
|
|
147
|
-
[2026-01-27T16:26:53+08:00] [INFO] 语言检测结果excel文件已生成:d:\test\词条\lang_20260127162653\lang_check_results.xlsx
|
|
148
|
-
[2026-01-27T16:26:53+08:00] [INFO] 全部转换完成,语言文件输出目录:d:\test\词条\lang_20260127162653
|
|
149
|
-
[2026-01-27T16:26:53+08:00] [INFO] excel转json功能执行完成
|
|
150
|
-
[2026-01-27T16:26:53+08:00] [INFO] 国际化模块执行完成
|
package/setting.json
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"i18n": {
|
|
3
|
-
"defaultKey": "en",
|
|
4
|
-
"langs": {
|
|
5
|
-
"cn": ["简体中文"],
|
|
6
|
-
"zh": ["繁体中文"],
|
|
7
|
-
"en": ["英语"],
|
|
8
|
-
"it": ["意大利语"],
|
|
9
|
-
"brpt": ["巴西葡语"],
|
|
10
|
-
"uk": ["乌克兰语"],
|
|
11
|
-
"ru": ["俄语"],
|
|
12
|
-
"es": ["欧洲西语"],
|
|
13
|
-
"hu": ["匈牙利语"],
|
|
14
|
-
"pl": ["波兰语"],
|
|
15
|
-
"tr": ["土耳其语"],
|
|
16
|
-
"de": ["德语"],
|
|
17
|
-
"fr": ["法语"],
|
|
18
|
-
"ro": ["罗马尼亚语"],
|
|
19
|
-
"ko": ["韩语"],
|
|
20
|
-
"cs": ["捷克语"],
|
|
21
|
-
"laes": ["拉美西语"],
|
|
22
|
-
"pt": ["欧洲葡语"],
|
|
23
|
-
"nl": ["荷兰语"]
|
|
24
|
-
},
|
|
25
|
-
"longCodes": {
|
|
26
|
-
"cn": "zh-CN",
|
|
27
|
-
"zh": "zh-TW",
|
|
28
|
-
"en": "en-US",
|
|
29
|
-
"it": "it-IT",
|
|
30
|
-
"brpt": "pt-BR",
|
|
31
|
-
"uk": "uk-UA",
|
|
32
|
-
"ru": "ru-RU",
|
|
33
|
-
"es": "es-ES",
|
|
34
|
-
"hu": "hu-HU",
|
|
35
|
-
"pl": "pl-PL",
|
|
36
|
-
"tr": "tr-TR",
|
|
37
|
-
"de": "de-DE",
|
|
38
|
-
"fr": "fr-FR",
|
|
39
|
-
"ro": "ro-RO",
|
|
40
|
-
"ko": "ko-KR",
|
|
41
|
-
"cs": "cs-CZ",
|
|
42
|
-
"laes": "es-MX",
|
|
43
|
-
"pt": "pt-PT",
|
|
44
|
-
"nl": "nl-NL"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|