Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
refactor(package): replace chalk with ansi-colors (dependencies) (
Browse files Browse the repository at this point in the history
#4)

BREAKING CHANGE: `module.exports.chalk` was renamed to `module.exports.colors`
  • Loading branch information
doowb authored and michael-ciniawsky committed Aug 23, 2018
1 parent 9e215a0 commit 5b793d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
22 changes: 10 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
'use strict';

const chalk = require('chalk');
const colors = require('ansi-colors');
const loglevel = require('loglevelnext'); //eslint-disable-line
const logSymbols = require('log-symbols');
const uuid = require('uuid/v4');

const symbols = {
trace: chalk.grey('₸'),
debug: chalk.cyan('➤'),
info: logSymbols.info,
warn: logSymbols.warning,
error: logSymbols.error
trace: colors.grey('₸'),
debug: colors.cyan('➤'),
info: colors.blue(colors.symbols.info),
warn: colors.yellow(colors.symbols.warning),
error: colors.red(colors.symbols.cross)
};

const defaults = {
Expand All @@ -21,7 +20,7 @@ const defaults = {

const prefix = {
level: opts => symbols[opts.level],
template: `{{level}} ${chalk.gray('「{{name}}」')}: `
template: `{{level}} ${colors.gray('「{{name}}」')}: `
};

module.exports = function webpackLog(options) {
Expand Down Expand Up @@ -59,10 +58,9 @@ module.exports = function webpackLog(options) {
};

// NOTE: this is exported so that consumers of webpack-log can use the same
// version of chalk to decorate log messages without incurring additional
// dependency overhead. This is an atypical practice, but chalk version
// segmentation is a common issue.
module.exports.chalk = chalk;
// version of ansi-colors to decorate log messages without incurring additional
// dependency overhead
module.exports.colors = colors;

/**
* @NOTE: This is an undocumented function solely for the purpose of tests.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"index.js"
],
"dependencies": {
"chalk": "^2.1.0",
"log-symbols": "^2.1.0",
"ansi-colors": "^3.0.0",
"loglevelnext": "^1.0.1",
"uuid": "^3.1.0"
},
Expand Down

0 comments on commit 5b793d4

Please sign in to comment.