Skip to content

Commit cb76ec4

Browse files
authored
Merge pull request #19 from bcomnes/remove-chalk
remove dependency on chalk
2 parents b3321cf + 0310089 commit cb76ec4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/run-task.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//------------------------------------------------------------------------------
1212

1313
const path = require("path")
14-
const chalk = require("chalk")
14+
const ansiStyles = require("ansi-styles")
1515
const parseArgs = require("shell-quote").parse
1616
const padEnd = require("string.prototype.padend")
1717
const createHeader = require("./create-header")
@@ -22,7 +22,7 @@ const spawn = require("./spawn")
2222
// Helpers
2323
//------------------------------------------------------------------------------
2424

25-
const colors = [chalk.cyan, chalk.green, chalk.magenta, chalk.yellow, chalk.red]
25+
const colors = ["cyan", "green", "magenta", "yellow", "red"]
2626

2727
let colorIndex = 0
2828
const taskNamesToColors = new Map()
@@ -57,8 +57,8 @@ function wrapLabeling(taskName, source, labelState) {
5757
}
5858

5959
const label = padEnd(taskName, labelState.width)
60-
const color = source.isTTY ? selectColor(taskName) : (x) => x
61-
const prefix = color(`[${label}] `)
60+
const color = source.isTTY ? ansiStyles[selectColor(taskName)] : { open: "", close: "" }
61+
const prefix = `${color.open}[${label}]${color.close} `
6262
const stream = createPrefixTransform(prefix, labelState)
6363

6464
stream.pipe(source)

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
},
3232
"dependencies": {
3333
"ansi-styles": "^4.2.1",
34-
"chalk": "^2.4.1",
3534
"cross-spawn": "^7.0.3",
3635
"memorystream": "^0.3.1",
3736
"minimatch": "^3.0.4",

0 commit comments

Comments
 (0)