Remove chalk dependency (#728)

This commit is contained in:
Jaco Greeff
2020-10-26 20:30:36 +01:00
committed by GitHub
parent a52e0dfb16
commit 73c89f4e3c
4 changed files with 9 additions and 16 deletions
+7
View File
@@ -1,5 +1,12 @@
# CHANGELOG
## 3.6.2-x
Changes:
- Remove the use of `chalk` (logger) for less overall dependencies
## 3.6.1 Oct 18, 2020
Contributed:
-1
View File
@@ -31,7 +31,6 @@
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.3",
"camelcase": "^5.3.1",
"chalk": "^4.1.0",
"ip-regex": "^4.2.0"
}
}
+2 -14
View File
@@ -3,8 +3,6 @@
import { Logger, Logger$Data } from './types';
import chalk from 'chalk';
import formatDate from './format/formatDate';
import isBn from './is/bn';
import isBuffer from './is/buffer';
@@ -23,13 +21,6 @@ const logTo = {
warn: 'warn'
};
const chalked = {
debug: chalk.gray,
error: chalk.red,
log: chalk.reset,
warn: chalk.yellow
};
function formatObject (value: Record<string, unknown>): Record<string, unknown> {
const result: Record<string, unknown> = {};
@@ -71,12 +62,9 @@ function apply (log: LogType, type: string, values: Logger$Data): void {
return apply(log, type, Array.isArray(fnResult) ? fnResult : [fnResult]);
}
const chalk = (value: string): string =>
chalked[log](value);
console[logTo[log] as 'log'](
chalk(formatDate(new Date())),
chalk(type),
formatDate(new Date()),
type,
...values.map(format)
);
}
-1
View File
@@ -1872,7 +1872,6 @@ __metadata:
"@types/bn.js": ^4.11.6
bn.js: ^5.1.3
camelcase: ^5.3.1
chalk: ^4.1.0
ip-regex: ^4.2.0
languageName: unknown
linkType: soft