Skip to content

Commit 56a3dcb

Browse files
committed
add colors to logs
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent 60c48ed commit 56a3dcb

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"esm": "^3.2.25",
2525
"inquirer": "^7.1.0",
2626
"js-yaml": "^3.14.0",
27+
"kleur": "^3.0.3",
2728
"listr": "^0.14.3",
2829
"lodash": "^4.17.15",
2930
"ncp": "^2.0.0",

src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "./utils/logs";
12
import build from "./build";
23
import create from "./create";
34

src/utils/logs.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { red, yellow, blue } from "kleur";
2+
3+
const _error = console.error;
4+
const _warn = console.warn;
5+
const _info = console.info;
6+
// const log = console.log;
7+
8+
console.error = function () {
9+
// @ts-ignore
10+
_error(red.apply(console, arguments));
11+
};
12+
13+
console.warn = function () {
14+
// @ts-ignore
15+
_warn(yellow.apply(console, arguments));
16+
};
17+
18+
console.info = function () {
19+
// @ts-ignore
20+
_info(blue.apply(console, arguments));
21+
};

0 commit comments

Comments
 (0)