+105
-4
lines changedFilter options
+105
-4
lines changed Original file line number Diff line number Diff line change
@@ -266,6 +266,18 @@ class View extends BaseCommand {
266
266
const deps = Object.entries(manifest.dependencies || {}).map(([k, dep]) =>
267
267
`${chalk.blue(k)}: ${dep}`
268
268
)
269
+
// Sort dist-tags by publish time, then tag name, keeping latest at the top of the list
270
+
const distTags = Object.entries(packu['dist-tags'])
271
+
.sort(([aTag, aVer], [bTag, bVer]) => {
272
+
const aTime = aTag === 'latest' ? Infinity : Date.parse(packu.time[aVer])
273
+
const bTime = bTag === 'latest' ? Infinity : Date.parse(packu.time[bVer])
274
+
if (aTime === bTime) {
275
+
return aTag > bTag ? -1 : 1
276
+
}
277
+
return aTime > bTime ? -1 : 1
278
+
})
279
+
.map(([k, t]) => `${chalk.blue(k)}: ${t}`)
280
+
269
281
const site = manifest.homepage?.url || manifest.homepage
270
282
const bins = Object.keys(manifest.bin || {})
271
283
const licenseField = manifest.license || 'Proprietary'
@@ -333,9 +345,11 @@ class View extends BaseCommand {
333
345
}
334
346
335
347
res.push('\ndist-tags:')
336
-
res.push(columns(Object.entries(packu['dist-tags']).map(([k, t]) =>
337
-
`${chalk.blue(k)}: ${t}`
338
-
)))
348
+
const maxTags = 12
349
+
res.push(columns(distTags.slice(0, maxTags), { padding: 1, sort: false }))
350
+
if (distTags.length > maxTags) {
351
+
res.push(chalk.dim(`(...and ${distTags.length - maxTags} more.)`))
352
+
}
339
353
340
354
const publisher = manifest._npmUser && unparsePerson({
341
355
name: chalk.blue(manifest._npmUser.name),
Original file line number Diff line number Diff line change
@@ -102,6 +102,18 @@ dist
102
102
103
103
dist-tags:
104
104
[34mlatest[39m: 1.0.0
105
+
[34mz[39m: 1.0.0
106
+
[34my[39m: 1.0.0
107
+
[34mv1[39m: 1.0.0
108
+
[34mprev[39m: 1.0.0
109
+
[34md[39m: 1.0.0
110
+
[34mc[39m: 1.0.0
111
+
[34mb[39m: 1.0.0
112
+
[34ma[39m: 1.0.0
113
+
[34mx[39m: 1.0.1
114
+
[34mnext[39m: 1.0.1
115
+
[34mh[39m: 1.0.1
116
+
[2m(...and 3 more.)[22m
105
117
106
118
published {TIME} ago[39m
107
119
`
@@ -116,6 +128,18 @@ dist
116
128
117
129
dist-tags:
118
130
[34mlatest[39m: 1.0.0
131
+
[34mz[39m: 1.0.0
132
+
[34my[39m: 1.0.0
133
+
[34mv1[39m: 1.0.0
134
+
[34mprev[39m: 1.0.0
135
+
[34md[39m: 1.0.0
136
+
[34mc[39m: 1.0.0
137
+
[34mb[39m: 1.0.0
138
+
[34ma[39m: 1.0.0
139
+
[34mx[39m: 1.0.1
140
+
[34mnext[39m: 1.0.1
141
+
[34mh[39m: 1.0.1
142
+
[2m(...and 3 more.)[22m
119
143
120
144
published {TIME} ago[39m
121
145
`
@@ -130,6 +154,18 @@ dist
130
154
131
155
dist-tags:
132
156
[34mlatest[39m: 1.0.0
157
+
[34mz[39m: 1.0.0
158
+
[34my[39m: 1.0.0
159
+
[34mv1[39m: 1.0.0
160
+
[34mprev[39m: 1.0.0
161
+
[34md[39m: 1.0.0
162
+
[34mc[39m: 1.0.0
163
+
[34mb[39m: 1.0.0
164
+
[34ma[39m: 1.0.0
165
+
[34mx[39m: 1.0.1
166
+
[34mnext[39m: 1.0.1
167
+
[34mh[39m: 1.0.1
168
+
[2m(...and 3 more.)[22m
133
169
134
170
published {TIME} ago[39m
135
171
`
@@ -269,6 +305,18 @@ dist
269
305
270
306
dist-tags:
271
307
[34mlatest[39m: 1.0.0
308
+
[34mz[39m: 1.0.0
309
+
[34my[39m: 1.0.0
310
+
[34mv1[39m: 1.0.0
311
+
[34mprev[39m: 1.0.0
312
+
[34md[39m: 1.0.0
313
+
[34mc[39m: 1.0.0
314
+
[34mb[39m: 1.0.0
315
+
[34ma[39m: 1.0.0
316
+
[34mx[39m: 1.0.1
317
+
[34mnext[39m: 1.0.1
318
+
[34mh[39m: 1.0.1
319
+
[2m(...and 3 more.)[22m
272
320
273
321
published {TIME} ago[39m
274
322
`
@@ -283,6 +331,18 @@ dist
283
331
284
332
dist-tags:
285
333
[34mlatest[39m: 1.0.0
334
+
[34mz[39m: 1.0.0
335
+
[34my[39m: 1.0.0
336
+
[34mv1[39m: 1.0.0
337
+
[34mprev[39m: 1.0.0
338
+
[34md[39m: 1.0.0
339
+
[34mc[39m: 1.0.0
340
+
[34mb[39m: 1.0.0
341
+
[34ma[39m: 1.0.0
342
+
[34mx[39m: 1.0.1
343
+
[34mnext[39m: 1.0.1
344
+
[34mh[39m: 1.0.1
345
+
[2m(...and 3 more.)[22m
286
346
287
347
published {TIME} ago[39m
288
348
@@ -296,8 +356,20 @@ dist
296
356
297
357
dist-tags:
298
358
[34mlatest[39m: 1.0.0
359
+
[34mz[39m: 1.0.0
360
+
[34my[39m: 1.0.0
361
+
[34mv1[39m: 1.0.0
362
+
[34mprev[39m: 1.0.0
363
+
[34md[39m: 1.0.0
364
+
[34mc[39m: 1.0.0
365
+
[34mb[39m: 1.0.0
366
+
[34ma[39m: 1.0.0
367
+
[34mx[39m: 1.0.1
368
+
[34mnext[39m: 1.0.1
369
+
[34mh[39m: 1.0.1
370
+
[2m(...and 3 more.)[22m
299
371
300
-
published [36mover a year from now[39m
372
+
published {TIME} ago[39m
301
373
`
302
374
303
375
exports[`test/lib/commands/view.js TAP package with single version full json > must match snapshot 1`] = `
Original file line number Diff line number Diff line change
@@ -36,10 +36,25 @@ const packument = (nv, opts) => {
36
36
_id: 'blue',
37
37
name: 'blue',
38
38
'dist-tags': {
39
+
v1: '1.0.0',
40
+
next: '1.0.1',
41
+
prev: '1.0.0',
39
42
latest: '1.0.0',
43
+
a: '1.0.0',
44
+
c: '1.0.0',
45
+
b: '1.0.0',
46
+
d: '1.0.0',
47
+
f: '1.0.1',
48
+
g: '1.0.1',
49
+
h: '1.0.1',
50
+
e: '1.0.1',
51
+
z: '1.0.0',
52
+
x: '1.0.1',
53
+
y: '1.0.0',
40
54
},
41
55
time: {
42
56
'1.0.0': yesterday,
57
+
'1.0.1': '2012-12-20T00:00:00.000Z',
43
58
},
44
59
versions: {
45
60
'1.0.0': {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4