Skip to content

Commit

Permalink
chore: use picocolors for colored terminal output (#409)
Browse files Browse the repository at this point in the history
Replace deprecated nanocolors with picocolors.
  • Loading branch information
ludofischer committed Nov 4, 2021
1 parent 66b7c80 commit ecf2bee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions index.js
Expand Up @@ -6,7 +6,7 @@ import path from 'path'
import prettyHrtime from 'pretty-hrtime'
import stdin from 'get-stdin'
import read from 'read-cache'
import { bold, dim, red, cyan, green } from 'nanocolors'
import pc from 'picocolors'
import { globby } from 'globby'
import slash from 'slash'
import chokidar from 'chokidar'
Expand Down Expand Up @@ -118,7 +118,7 @@ buildCliConfig()
.then((results) => {
if (argv.watch) {
const printMessage = () =>
printVerbose(dim('\nWaiting for file changes...'))
printVerbose(pc.dim('\nWaiting for file changes...'))
const watcher = chokidar.watch(input.concat(dependencies(results)), {
usePolling: argv.poll,
interval: argv.poll && typeof argv.poll === 'number' ? argv.poll : 100,
Expand Down Expand Up @@ -213,7 +213,7 @@ function css(css, file) {

const time = process.hrtime()

printVerbose(cyan(`Processing ${bold(relativePath)}...`))
printVerbose(pc.cyan(`Processing ${pc.bold(relativePath)}...`))

return rc(ctx, argv.config)
.then((config) => {
Expand Down Expand Up @@ -261,7 +261,9 @@ function css(css, file) {
return Promise.all(tasks).then(() => {
const prettyTime = prettyHrtime(process.hrtime(time))
printVerbose(
green(`Finished ${bold(relativePath)} in ${bold(prettyTime)}`)
pc.green(
`Finished ${pc.bold(relativePath)} in ${pc.bold(prettyTime)}`
)
)

const messages = result.warnings()
Expand Down Expand Up @@ -316,7 +318,7 @@ function error(err) {
if (argv.verbose) console.error()

if (typeof err === 'string') {
console.error(red(err))
console.error(pc.red(err))
} else if (err.name === 'CssSyntaxError') {
console.error(err.toString())
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -23,7 +23,7 @@
"fs-extra": "^10.0.0",
"get-stdin": "^9.0.0",
"globby": "^12.0.0",
"nanocolors": "^0.2.11",
"picocolors": "^1.0.0",
"postcss-load-config": "^3.0.0",
"postcss-reporter": "^7.0.0",
"pretty-hrtime": "^1.0.3",
Expand Down

0 comments on commit ecf2bee

Please sign in to comment.