Skip to content

Commit e8e5364

Browse files
committed
deps: remove ansicolors
1 parent c009afe commit e8e5364

File tree

10 files changed

+32
-227
lines changed

10 files changed

+32
-227
lines changed

lib/commands/help-search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs')
22
const path = require('path')
3-
const color = require('ansicolors')
3+
const chalk = require('chalk')
44
const { promisify } = require('util')
55
const glob = promisify(require('glob'))
66
const readFile = promisify(fs.readFile)
@@ -173,7 +173,7 @@ class HelpSearch extends BaseCommand {
173173
for (const f of finder) {
174174
hilitLine.push(line.slice(p, p + f.length))
175175
const word = line.slice(p + f.length, p + f.length + arg.length)
176-
const hilit = color.bgBlack(color.red(word))
176+
const hilit = chalk.bgBlack.red(word)
177177
hilitLine.push(hilit)
178178
p += f.length + arg.length
179179
}

lib/commands/view.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// npm view [pkg [pkg ...]]
55

6-
const color = require('ansicolors')
76
const chalk = require('chalk')
87
const columns = require('cli-columns')
98
const fs = require('fs')
@@ -318,34 +317,34 @@ class View extends BaseCommand {
318317

319318
Object.keys(packument['dist-tags']).forEach((t) => {
320319
const version = packument['dist-tags'][t]
321-
tags.push(`${chalk.bold(color.green(t))}: ${version}`)
320+
tags.push(`${chalk.bold.green(t)}: ${version}`)
322321
})
323322
const unpackedSize = manifest.dist.unpackedSize &&
324323
formatBytes(manifest.dist.unpackedSize, true)
325324
const licenseField = manifest.license || 'Proprietary'
326325
const info = {
327-
name: color.green(manifest.name),
328-
version: color.green(manifest.version),
329-
bins: Object.keys(manifest.bin || {}).map(color.yellow),
330-
versions: color.yellow(packument.versions.length + ''),
326+
name: chalk.green(manifest.name),
327+
version: chalk.green(manifest.version),
328+
bins: Object.keys(manifest.bin || {}),
329+
versions: chalk.yellow(packument.versions.length + ''),
331330
description: manifest.description,
332331
deprecated: manifest.deprecated,
333-
keywords: (packument.keywords || []).map(color.yellow),
332+
keywords: packument.keywords || [],
334333
license: typeof licenseField === 'string'
335334
? licenseField
336335
: (licenseField.type || 'Proprietary'),
337336
deps: Object.keys(manifest.dependencies || {}).map((dep) => {
338-
return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
337+
return `${chalk.yellow(dep)}: ${manifest.dependencies[dep]}`
339338
}),
340339
publisher: manifest._npmUser && unparsePerson({
341-
name: color.yellow(manifest._npmUser.name),
342-
email: color.cyan(manifest._npmUser.email),
340+
name: chalk.yellow(manifest._npmUser.name),
341+
email: chalk.cyan(manifest._npmUser.email),
343342
}),
344343
modified: !packument.time ? undefined
345-
: color.yellow(relativeDate(packument.time[manifest.version])),
344+
: chalk.yellow(relativeDate(packument.time[manifest.version])),
346345
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
347-
name: color.yellow(u.name),
348-
email: color.cyan(u.email),
346+
name: chalk.yellow(u.name),
347+
email: chalk.cyan(u.email),
349348
})),
350349
repo: (
351350
manifest.bugs && (manifest.bugs.url || manifest.bugs)
@@ -356,47 +355,47 @@ class View extends BaseCommand {
356355
manifest.homepage && (manifest.homepage.url || manifest.homepage)
357356
),
358357
tags,
359-
tarball: color.cyan(manifest.dist.tarball),
360-
shasum: color.yellow(manifest.dist.shasum),
358+
tarball: chalk.cyan(manifest.dist.tarball),
359+
shasum: chalk.yellow(manifest.dist.shasum),
361360
integrity:
362-
manifest.dist.integrity && color.yellow(manifest.dist.integrity),
361+
manifest.dist.integrity && chalk.yellow(manifest.dist.integrity),
363362
fileCount:
364-
manifest.dist.fileCount && color.yellow(manifest.dist.fileCount),
365-
unpackedSize: unpackedSize && color.yellow(unpackedSize),
363+
manifest.dist.fileCount && chalk.yellow(manifest.dist.fileCount),
364+
unpackedSize: unpackedSize && chalk.yellow(unpackedSize),
366365
}
367366
if (info.license.toLowerCase().trim() === 'proprietary') {
368-
info.license = chalk.bold(color.red(info.license))
367+
info.license = chalk.bold.red(info.license)
369368
} else {
370-
info.license = color.green(info.license)
369+
info.license = chalk.green(info.license)
371370
}
372371

373372
console.log('')
374373
console.log(
375374
chalk.underline.bold(`${info.name}@${info.version}`) +
376375
' | ' + info.license +
377-
' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) +
376+
' | deps: ' + (info.deps.length ? chalk.cyan(info.deps.length) : chalk.green('none')) +
378377
' | versions: ' + info.versions
379378
)
380379
info.description && console.log(info.description)
381380
if (info.repo || info.site) {
382-
info.site && console.log(color.cyan(info.site))
381+
info.site && console.log(chalk.cyan(info.site))
383382
}
384383

385384
const warningSign = unicode ? ' ⚠️ ' : '!!'
386385
info.deprecated && console.log(
387-
`\n${chalk.bold(color.red('DEPRECATED'))}${
386+
`\n${chalk.bold.red('DEPRECATED')}${
388387
warningSign
389388
} - ${info.deprecated}`
390389
)
391390

392391
if (info.keywords.length) {
393392
console.log('')
394-
console.log('keywords:', info.keywords.join(', '))
393+
console.log('keywords:', chalk.yellow(info.keywords.join(', ')))
395394
}
396395

397396
if (info.bins.length) {
398397
console.log('')
399-
console.log('bin:', info.bins.join(', '))
398+
console.log('bin:', chalk.yellow(info.bins.join(', ')))
400399
}
401400

402401
console.log('')

node_modules/ansicolors/LICENSE

Lines changed: 0 additions & 23 deletions
This file was deleted.

node_modules/ansicolors/ansicolors.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

node_modules/ansicolors/package.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

node_modules/ansicolors/test/ansicolors.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

package-lock.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"@npmcli/package-json",
1818
"@npmcli/run-script",
1919
"abbrev",
20-
"ansicolors",
2120
"archy",
2221
"cacache",
2322
"chalk",
@@ -95,7 +94,6 @@
9594
"@npmcli/package-json": "^2.0.0",
9695
"@npmcli/run-script": "^3.0.1",
9796
"abbrev": "~1.1.1",
98-
"ansicolors": "~0.3.2",
9997
"archy": "~1.0.0",
10098
"cacache": "^16.0.4",
10199
"chalk": "^4.1.2",
@@ -1240,11 +1238,6 @@
12401238
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
12411239
}
12421240
},
1243-
"node_modules/ansicolors": {
1244-
"version": "0.3.2",
1245-
"inBundle": true,
1246-
"license": "MIT"
1247-
},
12481241
"node_modules/anymatch": {
12491242
"version": "3.1.2",
12501243
"dev": true,
@@ -10754,9 +10747,6 @@
1075410747
"color-convert": "^2.0.1"
1075510748
}
1075610749
},
10757-
"ansicolors": {
10758-
"version": "0.3.2"
10759-
},
1076010750
"anymatch": {
1076110751
"version": "3.1.2",
1076210752
"dev": true,

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"@npmcli/package-json": "^2.0.0",
6464
"@npmcli/run-script": "^3.0.1",
6565
"abbrev": "~1.1.1",
66-
"ansicolors": "~0.3.2",
6766
"archy": "~1.0.0",
6867
"cacache": "^16.0.4",
6968
"chalk": "^4.1.2",
@@ -136,7 +135,6 @@
136135
"@npmcli/package-json",
137136
"@npmcli/run-script",
138137
"abbrev",
139-
"ansicolors",
140138
"archy",
141139
"cacache",
142140
"chalk",

0 commit comments

Comments
 (0)