Skip to content

Commit d4add03

Browse files
authoredOct 1, 2021
refactor: use nanocolors instead of chalk (#56)
1 parent 4159c65 commit d4add03

File tree

3 files changed

+8047
-5
lines changed

3 files changed

+8047
-5
lines changed
 

‎lib/log.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const { Console } = require('console');
4-
const chalk = require('chalk');
4+
const nanocolors = require('nanocolors');
55

66
const TRACE = 10;
77
const DEBUG = 20;
@@ -55,14 +55,14 @@ class Logger {
5555
const str = new Date().toISOString().substring(11, 23) + ' ';
5656

5757
if (level === TRACE || level >= WARN) {
58-
process.stderr.write(chalk[LEVEL_COLORS[DEBUG]](str));
58+
process.stderr.write(nanocolors[LEVEL_COLORS[DEBUG]](str));
5959
} else {
60-
process.stdout.write(chalk[LEVEL_COLORS[DEBUG]](str));
60+
process.stdout.write(nanocolors[LEVEL_COLORS[DEBUG]](str));
6161
}
6262
}
6363

6464
if (level >= this.level) {
65-
const str = chalk[LEVEL_COLORS[level]](LEVEL_NAMES[level]) + ' ';
65+
const str = nanocolors[LEVEL_COLORS[level]](LEVEL_NAMES[level]) + ' ';
6666
if (level === TRACE || level >= WARN) {
6767
process.stderr.write(str);
6868
} else {

‎package-lock.json

+8,042
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
],
3030
"license": "MIT",
3131
"dependencies": {
32-
"chalk": "^4.0.0"
32+
"nanocolors": "^0.2.12"
3333
},
3434
"devDependencies": {
3535
"chai": "^4.1.2",

0 commit comments

Comments
 (0)
Please sign in to comment.