Skip to content

Commit

Permalink
Use colorette instead of chalk
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Sep 15, 2020
1 parent 44057c3 commit c4826d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lib/formatter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var chalk = require('chalk');
var { bold, underline, yellow } = require('colorette');
var path = require('path');
var symbols = require('log-symbols');
var _ = require('lodash');
Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = function(opts) {
var output = '\n';

if (source) {
output += chalk.bold.underline(logFrom(source)) + '\n';
output += bold(underline(logFrom(source))) + '\n';
}

orderedMessages.forEach(function(w) {
Expand All @@ -52,24 +52,24 @@ module.exports = function(opts) {
var str = '';

if (location.line) {
str += chalk.bold(location.line);
str += bold(location.line);
}

if (location.column) {
str += chalk.bold(':' + location.column)
str += bold(':' + location.column)
}

if (location.line || location.column) {
str += '\t';
}

if (!options.noIcon && message.type === 'warning') {
str += chalk.yellow(symbols.warning + ' ');
str += yellow(symbols.warning + ' ');
}

str += message.text;
if (!options.noPlugin) {
str += chalk.yellow(' [' + message.plugin + ']');
str += yellow(' [' + message.plugin + ']');
}
return str;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/reporter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var defaultFormatter = require('./formatter');
var chalk = require('chalk');
var { red, bold } = require('colorette');
var util = require('./util');
var _ = require('lodash');

Expand Down Expand Up @@ -64,7 +64,7 @@ module.exports = function(opts = {}) {
console.log(report);

if (opts.throwError && shouldThrowError()) {
throw new Error(chalk.red.bold('\n** postcss-reporter: warnings or errors were found **'));
throw new Error(red(bold('\n** postcss-reporter: warnings or errors were found **')));
}

function shouldThrowError() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"tape": "^5.0.1"
},
"dependencies": {
"chalk": "^4.1.0",
"colorette": "^1.2.1",
"lodash": "^4.17.20",
"log-symbols": "^4.0.0"
}
Expand Down

0 comments on commit c4826d3

Please sign in to comment.