Skip to content

Commit c22fb1e

Browse files
wraithgarfritzy
authored andcommitted
deps: remove ansicolors
1 parent 605ccef commit c22fb1e

File tree

11 files changed

+43
-238
lines changed

11 files changed

+43
-238
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",
@@ -96,7 +95,6 @@
9695
"@npmcli/package-json": "^2.0.0",
9796
"@npmcli/run-script": "^3.0.1",
9897
"abbrev": "~1.1.1",
99-
"ansicolors": "~0.3.2",
10098
"archy": "~1.0.0",
10199
"cacache": "^16.0.4",
102100
"chalk": "^4.1.2",
@@ -1241,11 +1239,6 @@
12411239
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
12421240
}
12431241
},
1244-
"node_modules/ansicolors": {
1245-
"version": "0.3.2",
1246-
"inBundle": true,
1247-
"license": "MIT"
1248-
},
12491242
"node_modules/anymatch": {
12501243
"version": "3.1.2",
12511244
"dev": true,
@@ -10772,9 +10765,6 @@
1077210765
"color-convert": "^2.0.1"
1077310766
}
1077410767
},
10775-
"ansicolors": {
10776-
"version": "0.3.2"
10777-
},
1077810768
"anymatch": {
1077910769
"version": "3.1.2",
1078010770
"dev": true,

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"@npmcli/package-json": "^2.0.0",
6565
"@npmcli/run-script": "^3.0.1",
6666
"abbrev": "~1.1.1",
67-
"ansicolors": "~0.3.2",
6867
"archy": "~1.0.0",
6968
"cacache": "^16.0.4",
7069
"chalk": "^4.1.2",
@@ -137,7 +136,6 @@
137136
"@npmcli/package-json",
138137
"@npmcli/run-script",
139138
"abbrev",
140-
"ansicolors",
141139
"archy",
142140
"cacache",
143141
"chalk",

0 commit comments

Comments
 (0)