Skip to content

Commit

Permalink
deps: remove ansicolors
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored and fritzy committed Apr 13, 2022
1 parent 605ccef commit c22fb1e
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 238 deletions.
4 changes: 2 additions & 2 deletions lib/commands/help-search.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const color = require('ansicolors')
const chalk = require('chalk')
const { promisify } = require('util')
const glob = promisify(require('glob'))
const readFile = promisify(fs.readFile)
Expand Down Expand Up @@ -173,7 +173,7 @@ class HelpSearch extends BaseCommand {
for (const f of finder) {
hilitLine.push(line.slice(p, p + f.length))
const word = line.slice(p + f.length, p + f.length + arg.length)
const hilit = color.bgBlack(color.red(word))
const hilit = chalk.bgBlack.red(word)
hilitLine.push(hilit)
p += f.length + arg.length
}
Expand Down
49 changes: 24 additions & 25 deletions lib/commands/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// npm view [pkg [pkg ...]]

const color = require('ansicolors')
const chalk = require('chalk')
const columns = require('cli-columns')
const fs = require('fs')
Expand Down Expand Up @@ -318,34 +317,34 @@ class View extends BaseCommand {

Object.keys(packument['dist-tags']).forEach((t) => {
const version = packument['dist-tags'][t]
tags.push(`${chalk.bold(color.green(t))}: ${version}`)
tags.push(`${chalk.bold.green(t)}: ${version}`)
})
const unpackedSize = manifest.dist.unpackedSize &&
formatBytes(manifest.dist.unpackedSize, true)
const licenseField = manifest.license || 'Proprietary'
const info = {
name: color.green(manifest.name),
version: color.green(manifest.version),
bins: Object.keys(manifest.bin || {}).map(color.yellow),
versions: color.yellow(packument.versions.length + ''),
name: chalk.green(manifest.name),
version: chalk.green(manifest.version),
bins: Object.keys(manifest.bin || {}),
versions: chalk.yellow(packument.versions.length + ''),
description: manifest.description,
deprecated: manifest.deprecated,
keywords: (packument.keywords || []).map(color.yellow),
keywords: packument.keywords || [],
license: typeof licenseField === 'string'
? licenseField
: (licenseField.type || 'Proprietary'),
deps: Object.keys(manifest.dependencies || {}).map((dep) => {
return `${color.yellow(dep)}: ${manifest.dependencies[dep]}`
return `${chalk.yellow(dep)}: ${manifest.dependencies[dep]}`
}),
publisher: manifest._npmUser && unparsePerson({
name: color.yellow(manifest._npmUser.name),
email: color.cyan(manifest._npmUser.email),
name: chalk.yellow(manifest._npmUser.name),
email: chalk.cyan(manifest._npmUser.email),
}),
modified: !packument.time ? undefined
: color.yellow(relativeDate(packument.time[manifest.version])),
: chalk.yellow(relativeDate(packument.time[manifest.version])),
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
name: color.yellow(u.name),
email: color.cyan(u.email),
name: chalk.yellow(u.name),
email: chalk.cyan(u.email),
})),
repo: (
manifest.bugs && (manifest.bugs.url || manifest.bugs)
Expand All @@ -356,47 +355,47 @@ class View extends BaseCommand {
manifest.homepage && (manifest.homepage.url || manifest.homepage)
),
tags,
tarball: color.cyan(manifest.dist.tarball),
shasum: color.yellow(manifest.dist.shasum),
tarball: chalk.cyan(manifest.dist.tarball),
shasum: chalk.yellow(manifest.dist.shasum),
integrity:
manifest.dist.integrity && color.yellow(manifest.dist.integrity),
manifest.dist.integrity && chalk.yellow(manifest.dist.integrity),
fileCount:
manifest.dist.fileCount && color.yellow(manifest.dist.fileCount),
unpackedSize: unpackedSize && color.yellow(unpackedSize),
manifest.dist.fileCount && chalk.yellow(manifest.dist.fileCount),
unpackedSize: unpackedSize && chalk.yellow(unpackedSize),
}
if (info.license.toLowerCase().trim() === 'proprietary') {
info.license = chalk.bold(color.red(info.license))
info.license = chalk.bold.red(info.license)
} else {
info.license = color.green(info.license)
info.license = chalk.green(info.license)
}

console.log('')
console.log(
chalk.underline.bold(`${info.name}@${info.version}`) +
' | ' + info.license +
' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) +
' | deps: ' + (info.deps.length ? chalk.cyan(info.deps.length) : chalk.green('none')) +
' | versions: ' + info.versions
)
info.description && console.log(info.description)
if (info.repo || info.site) {
info.site && console.log(color.cyan(info.site))
info.site && console.log(chalk.cyan(info.site))
}

const warningSign = unicode ? ' ⚠️ ' : '!!'
info.deprecated && console.log(
`\n${chalk.bold(color.red('DEPRECATED'))}${
`\n${chalk.bold.red('DEPRECATED')}${
warningSign
} - ${info.deprecated}`
)

if (info.keywords.length) {
console.log('')
console.log('keywords:', info.keywords.join(', '))
console.log('keywords:', chalk.yellow(info.keywords.join(', ')))
}

if (info.bins.length) {
console.log('')
console.log('bin:', info.bins.join(', '))
console.log('bin:', chalk.yellow(info.bins.join(', ')))
}

console.log('')
Expand Down
23 changes: 0 additions & 23 deletions node_modules/ansicolors/LICENSE

This file was deleted.

65 changes: 0 additions & 65 deletions node_modules/ansicolors/ansicolors.js

This file was deleted.

23 changes: 0 additions & 23 deletions node_modules/ansicolors/package.json

This file was deleted.

71 changes: 0 additions & 71 deletions node_modules/ansicolors/test/ansicolors.js

This file was deleted.

10 changes: 0 additions & 10 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@npmcli/package-json",
"@npmcli/run-script",
"abbrev",
"ansicolors",
"archy",
"cacache",
"chalk",
Expand Down Expand Up @@ -96,7 +95,6 @@
"@npmcli/package-json": "^2.0.0",
"@npmcli/run-script": "^3.0.1",
"abbrev": "~1.1.1",
"ansicolors": "~0.3.2",
"archy": "~1.0.0",
"cacache": "^16.0.4",
"chalk": "^4.1.2",
Expand Down Expand Up @@ -1241,11 +1239,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/ansicolors": {
"version": "0.3.2",
"inBundle": true,
"license": "MIT"
},
"node_modules/anymatch": {
"version": "3.1.2",
"dev": true,
Expand Down Expand Up @@ -10772,9 +10765,6 @@
"color-convert": "^2.0.1"
}
},
"ansicolors": {
"version": "0.3.2"
},
"anymatch": {
"version": "3.1.2",
"dev": true,
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@npmcli/package-json": "^2.0.0",
"@npmcli/run-script": "^3.0.1",
"abbrev": "~1.1.1",
"ansicolors": "~0.3.2",
"archy": "~1.0.0",
"cacache": "^16.0.4",
"chalk": "^4.1.2",
Expand Down Expand Up @@ -137,7 +136,6 @@
"@npmcli/package-json",
"@npmcli/run-script",
"abbrev",
"ansicolors",
"archy",
"cacache",
"chalk",
Expand Down
Loading

0 comments on commit c22fb1e

Please sign in to comment.