Skip to content

Commit

Permalink
feat(common): remove cli-color dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Oct 30, 2020
1 parent da13cca commit b8a52cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/common/package.json
Expand Up @@ -18,7 +18,6 @@
"license": "MIT",
"dependencies": {
"axios": "0.20.0",
"cli-color": "2.0.0",
"iterare": "1.2.1",
"tslib": "2.0.3",
"uuid": "8.3.1"
Expand Down
3 changes: 1 addition & 2 deletions packages/common/services/logger.service.ts
@@ -1,10 +1,9 @@
import * as clc from 'cli-color';
import { Injectable } from '../decorators/core/injectable.decorator';
import { Optional } from '../decorators/core/optional.decorator';
import { clc, yellow } from '../utils/cli-colors.util';
import { isObject } from '../utils/shared.utils';

declare const process: any;
const yellow = clc.xterm(3);

export type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';

Expand Down
8 changes: 8 additions & 0 deletions packages/common/utils/cli-colors.util.ts
@@ -0,0 +1,8 @@
export const clc = {
green: (text: string) => `\x1B[32m${text}\x1B[39m`,
yellow: (text: string) => `\x1B[33m${text}\x1B[39m`,
red: (text: string) => `\x1B[31m${text}\x1B[39m`,
magentaBright: (text: string) => `\x1B[95m${text}\x1B[39m`,
cyanBright: (text: string) => `\x1B[96m${text}\x1B[39m`,
};
export const yellow = (text: string) => `\x1B[38;5;3m${text}\x1B[39m`;

3 comments on commit b8a52cc

@denodaeus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks folks who use the NO_COLOR env variable to turn off colors in the log, something we just experienced.

@pmjhonwang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same problem @denodaeus

need a option like noColor: boolean

@kamilmysliwiec or need I post a PR

@kamilmysliwiec
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be fixed in the next patch release cf2fbb9

Please sign in to comment.