-
-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Proxyquire as it did not handle newer syntax
The defaults of Prettier 3 threw Proxyquirify into a frenzy. Did the minimal rewrite (DI) that worked
- Loading branch information
Showing
9 changed files
with
101 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
"use strict"; | ||
|
||
const supportsColor = require("supports-color"); | ||
|
||
function colorize(str, color) { | ||
if (supportsColor.stdout === false) { | ||
return str; | ||
module.exports = class Colorizer { | ||
constructor(supportsColor = require("supports-color")) { | ||
this.supportsColor = supportsColor; | ||
} | ||
|
||
return `\x1b[${color}m${str}\x1b[0m`; | ||
} | ||
colorize(str, color) { | ||
if (this.supportsColor.stdout === false) { | ||
return str; | ||
} | ||
|
||
exports.red = function (str) { | ||
return colorize(str, 31); | ||
}; | ||
return `\x1b[${color}m${str}\x1b[0m`; | ||
} | ||
|
||
exports.green = function (str) { | ||
return colorize(str, 32); | ||
}; | ||
red(str) { | ||
return this.colorize(str, 31); | ||
} | ||
|
||
exports.cyan = function (str) { | ||
return colorize(str, 96); | ||
}; | ||
green(str) { | ||
return this.colorize(str, 32); | ||
} | ||
|
||
exports.white = function (str) { | ||
return colorize(str, 39); | ||
}; | ||
cyan(str) { | ||
return this.colorize(str, 96); | ||
} | ||
|
||
exports.bold = function (str) { | ||
return colorize(str, 1); | ||
white(str) { | ||
return this.colorize(str, 39); | ||
} | ||
|
||
bold(str) { | ||
return this.colorize(str, 1); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.