Skip to content

Commit

Permalink
Update chalk to use the latest updates to supports-color (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslilac authored and sindresorhus committed Feb 11, 2018
1 parent 011dd04 commit 678152c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions index.js
@@ -1,7 +1,7 @@
'use strict';
const escapeStringRegexp = require('escape-string-regexp');
const ansiStyles = require('ansi-styles');
const supportsColor = require('supports-color');
const stdoutColor = require('supports-color').stdout;

const template = require('./templates.js');

Expand All @@ -19,7 +19,7 @@ function applyOptions(obj, options) {
options = options || {};

// Detect level if not set manually
const scLevel = supportsColor ? supportsColor.level : 0;
const scLevel = stdoutColor ? stdoutColor.level : 0;
obj.level = options.level === undefined ? scLevel : options.level;
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
}
Expand Down Expand Up @@ -224,5 +224,5 @@ function chalkTag(chalk, strings) {
Object.defineProperties(Chalk.prototype, styles);

module.exports = Chalk(); // eslint-disable-line new-cap
module.exports.supportsColor = supportsColor;
module.exports.supportsColor = stdoutColor;
module.exports.default = module.exports; // For TypeScript
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"ansi-styles": "^3.1.0",
"escape-string-regexp": "^1.0.5",
"supports-color": "^4.0.0"
"supports-color": "^5.0.0"
},
"devDependencies": {
"ava": "*",
Expand Down
10 changes: 6 additions & 4 deletions test/_supports-color.js
Expand Up @@ -4,10 +4,12 @@ const resolveFrom = require('resolve-from');
module.exports = dir => {
require.cache[resolveFrom(dir, 'supports-color')] = {
exports: {
level: 3,
hasBasic: true,
has256: true,
has16m: true
stdout: {
level: 3,
hasBasic: true,
has256: true,
has16m: true
}
}
};
};

0 comments on commit 678152c

Please sign in to comment.