Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace chalk with picocolors (#6039)
* Replace chalk with picocolors Already used in latest postcss, autoprefixer and browserslist versions. See https://github.com/alexeyraspopov/picocolors * Update `dim` function Co-authored-by: Brad Cornes <bradlc41@gmail.com>
- Loading branch information
Showing
4 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,29 +1,29 @@ | ||
import chalk from 'chalk' | ||
import colors from 'picocolors' | ||
|
||
let alreadyShown = new Set() | ||
|
||
function log(chalk, messages, key) { | ||
function log(type, messages, key) { | ||
if (process.env.JEST_WORKER_ID !== undefined) return | ||
|
||
if (key && alreadyShown.has(key)) return | ||
if (key) alreadyShown.add(key) | ||
|
||
console.warn('') | ||
messages.forEach((message) => console.warn(chalk, '-', message)) | ||
messages.forEach((message) => console.warn(type, '-', message)) | ||
} | ||
|
||
export function dim(input) { | ||
return chalk.dim(input) | ||
return colors.dim(input) | ||
} | ||
|
||
export default { | ||
info(key, messages) { | ||
log(chalk.bold.cyan('info'), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
log(colors.bold(colors.cyan('info')), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
}, | ||
warn(key, messages) { | ||
log(chalk.bold.yellow('warn'), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
log(colors.bold(colors.yellow('warn')), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
}, | ||
risk(key, messages) { | ||
log(chalk.bold.magenta('risk'), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
log(colors.bold(colors.magenta('risk')), ...(Array.isArray(key) ? [key] : [messages, key])) | ||
}, | ||
} |