Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/commands/doctor.js')
-rw-r--r--deps/npm/lib/commands/doctor.js34
1 files changed, 12 insertions, 22 deletions
diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js
index ca0438f1a24..f5bee1eb83f 100644
--- a/deps/npm/lib/commands/doctor.js
+++ b/deps/npm/lib/commands/doctor.js
@@ -1,5 +1,4 @@
const cacache = require('cacache')
-const chalk = require('chalk')
const fs = require('fs')
const fetch = require('make-fetch-happen')
const table = require('text-table')
@@ -102,28 +101,19 @@ class Doctor extends BaseCommand {
messages.push(line)
}
- const outHead = ['Check', 'Value', 'Recommendation/Notes'].map(
- !this.npm.color ? h => h : h => chalk.underline(h)
- )
+ const outHead = ['Check', 'Value', 'Recommendation/Notes'].map(h => this.npm.chalk.underline(h))
let allOk = true
- const outBody = messages.map(
- !this.npm.color
- ? item => {
- allOk = allOk && item[1]
- item[1] = item[1] ? 'ok' : 'not ok'
- item[2] = String(item[2])
- return item
- }
- : item => {
- allOk = allOk && item[1]
- if (!item[1]) {
- item[0] = chalk.red(item[0])
- item[2] = chalk.magenta(String(item[2]))
- }
- item[1] = item[1] ? chalk.green('ok') : chalk.red('not ok')
- return item
- }
- )
+ const outBody = messages.map(item => {
+ if (!item[1]) {
+ allOk = false
+ item[0] = this.npm.chalk.red(item[0])
+ item[1] = this.npm.chalk.red('not ok')
+ item[2] = this.npm.chalk.magenta(String(item[2]))
+ } else {
+ item[1] = this.npm.chalk.green('ok')
+ }
+ return item
+ })
const outTable = [outHead, ...outBody]
const tableOpts = {
stringLength: s => ansiTrim(s).length,