Skip to content

Commit 5c03826

Browse files
committed
fix: remove tabular output from "npm view"
1 parent 4648f26 commit 5c03826

File tree

2 files changed

+17
-90
lines changed

2 files changed

+17
-90
lines changed

lib/commands/view.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const columns = require('cli-columns')
21
const { readFile } = require('node:fs/promises')
32
const jsonParse = require('json-parse-even-better-errors')
43
const { log, output, META } = require('proc-log')
@@ -333,7 +332,7 @@ class View extends BaseCommand {
333332
if (deps.length) {
334333
const maxDeps = 24
335334
res.push('\ndependencies:')
336-
res.push(columns(deps.slice(0, maxDeps), { padding: 1 }))
335+
res.push(deps.slice(0, maxDeps).join(', '))
337336
if (deps.length > maxDeps) {
338337
res.push(chalk.dim(`(...and ${deps.length - maxDeps} more.)`))
339338
}
@@ -349,8 +348,8 @@ class View extends BaseCommand {
349348
}
350349

351350
res.push('\ndist-tags:')
352-
const maxTags = 12
353-
res.push(columns(distTags.slice(0, maxTags), { padding: 1, sort: false }))
351+
const maxTags = 5
352+
res.push(distTags.slice(0, maxTags).join('\n'))
354353
if (distTags.length > maxTags) {
355354
res.push(chalk.dim(`(...and ${distTags.length - maxTags} more.)`))
356355
}

tap-snapshots/test/lib/commands/view.js.test.cjs

Lines changed: 14 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ dist
3939
.unpackedSize: 1.0 GB
4040
4141
dependencies:
42-
red: 1.0.0
43-
yellow: 1.0.0
42+
red: 1.0.0, yellow: 1.0.0
4443
4544
maintainers:
4645
- claudia <[[email protected]>
@@ -68,8 +67,7 @@ dist
6867
.unpackedSize: 1.0 GB
6968
7069
dependencies:
71-
red: 1.0.0
72-
yellow: 1.0.0
70+
red: 1.0.0, yellow: 1.0.0
7371
7472
maintainers:
7573
- claudia <[[email protected]>
@@ -97,8 +95,7 @@ dist
9795
.unpackedSize: 1.0 GB
9896
9997
dependencies:
100-
red: 1.0.0
101-
yellow: 1.0.0
98+
red: 1.0.0, yellow: 1.0.0
10299
103100
maintainers:
104101
- claudia <[[email protected]>
@@ -122,14 +119,7 @@ dist-tags:
122119
y: 1.0.0
123120
v1: 1.0.0
124121
prev: 1.0.0
125-
d: 1.0.0
126-
c: 1.0.0
127-
b: 1.0.0
128-
a: 1.0.0
129-
x: 1.0.1
130-
next: 1.0.1
131-
h: 1.0.1
132-
(...and 3 more.)
122+
(...and 10 more.)
133123
134124
published {TIME} ago
135125
`
@@ -148,14 +138,7 @@ dist-tags:
148138
y: 1.0.0
149139
v1: 1.0.0
150140
prev: 1.0.0
151-
d: 1.0.0
152-
c: 1.0.0
153-
b: 1.0.0
154-
a: 1.0.0
155-
x: 1.0.1
156-
next: 1.0.1
157-
h: 1.0.1
158-
(...and 3 more.)
141+
(...and 10 more.)
159142
160143
published {TIME} ago
161144
`
@@ -174,14 +157,7 @@ dist-tags:
174157
y: 1.0.0
175158
v1: 1.0.0
176159
prev: 1.0.0
177-
d: 1.0.0
178-
c: 1.0.0
179-
b: 1.0.0
180-
a: 1.0.0
181-
x: 1.0.1
182-
next: 1.0.1
183-
h: 1.0.1
184-
(...and 3 more.)
160+
(...and 10 more.)
185161
186162
published {TIME} ago
187163
`
@@ -265,30 +241,7 @@ dist
265241
.unpackedSize: 1 B
266242
267243
dependencies:
268-
0: 1.0.0
269-
10: 1.0.0
270-
11: 1.0.0
271-
12: 1.0.0
272-
13: 1.0.0
273-
14: 1.0.0
274-
15: 1.0.0
275-
16: 1.0.0
276-
17: 1.0.0
277-
18: 1.0.0
278-
19: 1.0.0
279-
1: 1.0.0
280-
20: 1.0.0
281-
21: 1.0.0
282-
22: 1.0.0
283-
23: 1.0.0
284-
2: 1.0.0
285-
3: 1.0.0
286-
4: 1.0.0
287-
5: 1.0.0
288-
6: 1.0.0
289-
7: 1.0.0
290-
8: 1.0.0
291-
9: 1.0.0
244+
0: 1.0.0, 1: 1.0.0, 2: 1.0.0, 3: 1.0.0, 4: 1.0.0, 5: 1.0.0, 6: 1.0.0, 7: 1.0.0, 8: 1.0.0, 9: 1.0.0, 10: 1.0.0, 11: 1.0.0, 12: 1.0.0, 13: 1.0.0, 14: 1.0.0, 15: 1.0.0, 16: 1.0.0, 17: 1.0.0, 18: 1.0.0, 19: 1.0.0, 20: 1.0.0, 21: 1.0.0, 22: 1.0.0, 23: 1.0.0
292245
(...and 1 more.)
293246
294247
dist-tags:
@@ -325,14 +278,7 @@ dist-tags:
325278
y: 1.0.0
326279
v1: 1.0.0
327280
prev: 1.0.0
328-
d: 1.0.0
329-
c: 1.0.0
330-
b: 1.0.0
331-
a: 1.0.0
332-
x: 1.0.1
333-
next: 1.0.1
334-
h: 1.0.1
335-
(...and 3 more.)
281+
(...and 10 more.)
336282
337283
published {TIME} ago
338284
`
@@ -351,14 +297,7 @@ dist-tags:
351297
y: 1.0.0
352298
v1: 1.0.0
353299
prev: 1.0.0
354-
d: 1.0.0
355-
c: 1.0.0
356-
b: 1.0.0
357-
a: 1.0.0
358-
x: 1.0.1
359-
next: 1.0.1
360-
h: 1.0.1
361-
(...and 3 more.)
300+
(...and 10 more.)
362301
363302
published {TIME} ago
364303
@@ -376,14 +315,7 @@ dist-tags:
376315
y: 1.0.0
377316
v1: 1.0.0
378317
prev: 1.0.0
379-
d: 1.0.0
380-
c: 1.0.0
381-
b: 1.0.0
382-
a: 1.0.0
383-
x: 1.0.1
384-
next: 1.0.1
385-
h: 1.0.1
386-
(...and 3 more.)
318+
(...and 10 more.)
387319
388320
published {TIME} ago
389321
`
@@ -469,8 +401,7 @@ dist
469401
.unpackedSize: 1.0 GB
470402
471403
dependencies:
472-
red: 1.0.0
473-
yellow: 1.0.0
404+
red: 1.0.0, yellow: 1.0.0
474405
475406
maintainers:
476407
- claudia <[[email protected]>
@@ -579,8 +510,7 @@ dist
579510
.unpackedSize: 1.0 GB
580511
581512
dependencies:
582-
red: 1.0.0
583-
yellow: 1.0.0
513+
red: 1.0.0, yellow: 1.0.0
584514
585515
maintainers:
586516
- claudia <[[email protected]>
@@ -695,8 +625,7 @@ dist
695625
.unpackedSize: 1.0 GB
696626
697627
dependencies:
698-
red: 1.0.0
699-
yellow: 1.0.0
628+
red: 1.0.0, yellow: 1.0.0
700629
701630
maintainers:
702631
- claudia <[[email protected]>
@@ -759,8 +688,7 @@ dist
759688
.unpackedSize: 1.0 GB
760689
761690
dependencies:
762-
red: 1.0.0
763-
yellow: 1.0.0
691+
red: 1.0.0, yellow: 1.0.0
764692
765693
maintainers:
766694
- claudia <[[email protected]>

0 commit comments

Comments
 (0)