@aiot-toolkit/shared-utils 2.0.2 → 2.0.3-beta.1
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/lib/utils/CommonUtil.d.ts +0 -9
- package/lib/utils/CommonUtil.js +0 -18
- package/package.json +2 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema, SomeJTDSchemaType } from 'ajv/dist/core';
|
|
2
|
-
import { ILog } from '../interface/ILog';
|
|
3
2
|
export type JSONSchemaType = Schema & SomeJTDSchemaType;
|
|
4
3
|
/**
|
|
5
4
|
* 不好分类的工具函数
|
|
@@ -41,13 +40,5 @@ declare class CommonUtil {
|
|
|
41
40
|
*/
|
|
42
41
|
static validateJson(json: JSON, schema: JSONSchemaType): Error[] | undefined;
|
|
43
42
|
static outputQRCodeOnTerminal(text: string): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* 终端环境下处理日志列表
|
|
46
|
-
*
|
|
47
|
-
* 1. 用ColorConsole输出日志
|
|
48
|
-
* 2. 如果日志中有Error/Throw,则终止程序
|
|
49
|
-
* @param logs
|
|
50
|
-
*/
|
|
51
|
-
static processingLogsInTerminal(logs?: ILog[]): void;
|
|
52
43
|
}
|
|
53
44
|
export default CommonUtil;
|
package/lib/utils/CommonUtil.js
CHANGED
|
@@ -112,23 +112,5 @@ class CommonUtil {
|
|
|
112
112
|
console.log(qrcode);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
/**
|
|
116
|
-
* 终端环境下处理日志列表
|
|
117
|
-
*
|
|
118
|
-
* 1. 用ColorConsole输出日志
|
|
119
|
-
* 2. 如果日志中有Error/Throw,则终止程序
|
|
120
|
-
* @param logs
|
|
121
|
-
*/
|
|
122
|
-
static processingLogsInTerminal(logs) {
|
|
123
|
-
if (!logs) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
logs.forEach((log) => {
|
|
127
|
-
ColorConsole_1.default.logger(log);
|
|
128
|
-
});
|
|
129
|
-
if (logs.some((log) => log.level === ILog_1.Loglevel.ERROR || log.level === ILog_1.Loglevel.THROW)) {
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
115
|
}
|
|
134
116
|
exports.default = CommonUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/shared-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-beta.1",
|
|
4
4
|
"description": "The common method functions of the aiot-toolkit.",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@types/minimatch": "^5.1.2",
|
|
42
42
|
"@types/qrcode": "^1.5.5"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "77b1b0aab9b5c227b5cc355b585a7c93761cc9a3"
|
|
45
45
|
}
|