Skip to content

Commit 605ccef

Browse files
wraithgarfritzy
authored andcommitted
deps: remove ansistyles
chalk is already in use elsewhere and does what we need
1 parent 0cd852f commit 605ccef

File tree

12 files changed

+56
-169
lines changed

12 files changed

+56
-169
lines changed

lib/commands/outdated.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ const os = require('os')
22
const path = require('path')
33
const pacote = require('pacote')
44
const table = require('text-table')
5-
const color = require('chalk')
6-
const styles = require('ansistyles')
5+
const chalk = require('chalk')
76
const npa = require('npm-package-arg')
87
const pickManifest = require('npm-pick-manifest')
98
const localeCompare = require('@isaacs/string-locale-compare')('en')
@@ -106,7 +105,7 @@ class Outdated extends ArboristWorkspaceCmd {
106105
const outTable = [outHead].concat(outList)
107106

108107
if (this.npm.color) {
109-
outTable[0] = outTable[0].map(heading => styles.underline(heading))
108+
outTable[0] = outTable[0].map(heading => chalk.underline(heading))
110109
}
111110

112111
const tableOpts = {
@@ -282,7 +281,7 @@ class Outdated extends ArboristWorkspaceCmd {
282281
: node.name
283282

284283
return this.npm.color && humanOutput
285-
? color.green(workspaceName)
284+
? chalk.green(workspaceName)
286285
: workspaceName
287286
}
288287

@@ -307,9 +306,9 @@ class Outdated extends ArboristWorkspaceCmd {
307306
}
308307

309308
if (this.npm.color) {
310-
columns[0] = color[current === wanted ? 'yellow' : 'red'](columns[0]) // current
311-
columns[2] = color.green(columns[2]) // wanted
312-
columns[3] = color.magenta(columns[3]) // latest
309+
columns[0] = chalk[current === wanted ? 'yellow' : 'red'](columns[0]) // current
310+
columns[2] = chalk.green(columns[2]) // wanted
311+
columns[3] = chalk.magenta(columns[3]) // latest
313312
}
314313

315314
return columns

lib/commands/profile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const inspect = require('util').inspect
22
const { URL } = require('url')
3-
const ansistyles = require('ansistyles')
3+
const chalk = require('chalk')
44
const log = require('../utils/log-shim.js')
55
const npmProfile = require('npm-profile')
66
const qrcodeTerminal = require('qrcode-terminal')
@@ -163,7 +163,7 @@ class Profile extends BaseCommand {
163163
} else {
164164
const table = new Table()
165165
for (const key of Object.keys(cleaned)) {
166-
table.push({ [ansistyles.bright(key)]: cleaned[key] })
166+
table.push({ [chalk.bold(key)]: cleaned[key] })
167167
}
168168

169169
this.npm.output(table.toString())

lib/commands/token.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Table = require('cli-table3')
2-
const ansistyles = require('ansistyles')
2+
const chalk = require('chalk')
33
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
44
const log = require('../utils/log-shim.js')
55
const profile = require('npm-profile')
@@ -161,7 +161,7 @@ class Token extends BaseCommand {
161161
} else {
162162
const table = new Table()
163163
for (const k of Object.keys(result)) {
164-
table.push({ [ansistyles.bright(k)]: String(result[k]) })
164+
table.push({ [chalk.bold(k)]: String(result[k]) })
165165
}
166166
this.npm.output(table.toString())
167167
}

lib/commands/view.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// npm view [pkg [pkg ...]]
55

66
const color = require('ansicolors')
7+
const chalk = require('chalk')
78
const columns = require('cli-columns')
89
const fs = require('fs')
910
const jsonParse = require('json-parse-even-better-errors')
@@ -13,7 +14,6 @@ const { resolve } = require('path')
1314
const formatBytes = require('../utils/format-bytes.js')
1415
const relativeDate = require('tiny-relative-date')
1516
const semver = require('semver')
16-
const style = require('ansistyles')
1717
const { inspect, promisify } = require('util')
1818
const { packument } = require('pacote')
1919

@@ -318,7 +318,7 @@ class View extends BaseCommand {
318318

319319
Object.keys(packument['dist-tags']).forEach((t) => {
320320
const version = packument['dist-tags'][t]
321-
tags.push(`${style.bright(color.green(t))}: ${version}`)
321+
tags.push(`${chalk.bold(color.green(t))}: ${version}`)
322322
})
323323
const unpackedSize = manifest.dist.unpackedSize &&
324324
formatBytes(manifest.dist.unpackedSize, true)
@@ -365,14 +365,14 @@ class View extends BaseCommand {
365365
unpackedSize: unpackedSize && color.yellow(unpackedSize),
366366
}
367367
if (info.license.toLowerCase().trim() === 'proprietary') {
368-
info.license = style.bright(color.red(info.license))
368+
info.license = chalk.bold(color.red(info.license))
369369
} else {
370370
info.license = color.green(info.license)
371371
}
372372

373373
console.log('')
374374
console.log(
375-
style.underline(style.bright(`${info.name}@${info.version}`)) +
375+
chalk.underline.bold(`${info.name}@${info.version}`) +
376376
' | ' + info.license +
377377
' | deps: ' + (info.deps.length ? color.cyan(info.deps.length) : color.green('none')) +
378378
' | versions: ' + info.versions
@@ -384,7 +384,7 @@ class View extends BaseCommand {
384384

385385
const warningSign = unicode ? ' ⚠️ ' : '!!'
386386
info.deprecated && console.log(
387-
`\n${style.bright(color.red('DEPRECATED'))}${
387+
`\n${chalk.bold(color.red('DEPRECATED'))}${
388388
warningSign
389389
} - ${info.deprecated}`
390390
)

node_modules/ansistyles/LICENSE

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

node_modules/ansistyles/ansistyles.js

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

node_modules/ansistyles/package.json

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

node_modules/ansistyles/test/ansistyles.js

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

package-lock.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"@npmcli/run-script",
1919
"abbrev",
2020
"ansicolors",
21-
"ansistyles",
2221
"archy",
2322
"cacache",
2423
"chalk",
@@ -98,7 +97,6 @@
9897
"@npmcli/run-script": "^3.0.1",
9998
"abbrev": "~1.1.1",
10099
"ansicolors": "~0.3.2",
101-
"ansistyles": "~0.1.3",
102100
"archy": "~1.0.0",
103101
"cacache": "^16.0.4",
104102
"chalk": "^4.1.2",
@@ -1248,11 +1246,6 @@
12481246
"inBundle": true,
12491247
"license": "MIT"
12501248
},
1251-
"node_modules/ansistyles": {
1252-
"version": "0.1.3",
1253-
"inBundle": true,
1254-
"license": "MIT"
1255-
},
12561249
"node_modules/anymatch": {
12571250
"version": "3.1.2",
12581251
"dev": true,
@@ -10782,9 +10775,6 @@
1078210775
"ansicolors": {
1078310776
"version": "0.3.2"
1078410777
},
10785-
"ansistyles": {
10786-
"version": "0.1.3"
10787-
},
1078810778
"anymatch": {
1078910779
"version": "3.1.2",
1079010780
"dev": true,

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"@npmcli/run-script": "^3.0.1",
6666
"abbrev": "~1.1.1",
6767
"ansicolors": "~0.3.2",
68-
"ansistyles": "~0.1.3",
6968
"archy": "~1.0.0",
7069
"cacache": "^16.0.4",
7170
"chalk": "^4.1.2",
@@ -139,7 +138,6 @@
139138
"@npmcli/run-script",
140139
"abbrev",
141140
"ansicolors",
142-
"ansistyles",
143141
"archy",
144142
"cacache",
145143
"chalk",

0 commit comments

Comments
 (0)