Skip to content

Commit 791276d

Browse files
authored
chore: drop prod dependency on chalk. (#58)
* Inline the warning symbol to drop prod dependency on log-symbols, which depends on chalk.
1 parent 72002c7 commit 791276d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/formatter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
var { bold, underline, yellow } = require('colorette');
22
var path = require('path');
3-
var symbols = require('log-symbols');
43
var sortBy = require('lodash.sortby');
54
var util = require('./util');
65

6+
var supportsLargeCharset = process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color';
7+
var warningSymbol = supportsLargeCharset ? '⚠' : '!!';
8+
79
module.exports = function(opts) {
810
var options = opts || {};
911
var sortByPosition = (typeof options.sortByPosition !== 'undefined') ? options.sortByPosition : true;
@@ -64,7 +66,7 @@ module.exports = function(opts) {
6466
}
6567

6668
if (!options.noIcon && message.type === 'warning') {
67-
str += yellow(symbols.warning + ' ');
69+
str += yellow(warningSymbol + ' ');
6870
}
6971

7072
str += message.text;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"eslint": "7.10.0",
3535
"less": "3.12.2",
3636
"lodash": "^4.17.20",
37+
"log-symbols": "^4.0.0",
3738
"postcss": "^8.1.0",
3839
"source-map": "0.7.3",
3940
"strip-color": "^0.1.0",
@@ -46,7 +47,6 @@
4647
"lodash.forown": "^4.4.0",
4748
"lodash.get": "^4.4.2",
4849
"lodash.groupby": "^4.6.0",
49-
"lodash.sortby": "^4.7.0",
50-
"log-symbols": "^4.0.0"
50+
"lodash.sortby": "^4.7.0"
5151
}
5252
}

0 commit comments

Comments
 (0)