A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/70cd88d95aa06ac96154c14ee262076704af807f below:

sort and truncate dist-tags (#7808) · npm/cli@70cd88d · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+105

-4

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+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

latest: 1.0.0

105 +

z: 1.0.0

106 +

y: 1.0.0

107 +

v1: 1.0.0

108 +

prev: 1.0.0

109 +

d: 1.0.0

110 +

c: 1.0.0

111 +

b: 1.0.0

112 +

a: 1.0.0

113 +

x: 1.0.1

114 +

next: 1.0.1

115 +

h: 1.0.1

116 +

(...and 3 more.)

105 117 106 118

published {TIME} ago

107 119

`

@@ -116,6 +128,18 @@ dist

116 128 117 129

dist-tags:

118 130

latest: 1.0.0

131 +

z: 1.0.0

132 +

y: 1.0.0

133 +

v1: 1.0.0

134 +

prev: 1.0.0

135 +

d: 1.0.0

136 +

c: 1.0.0

137 +

b: 1.0.0

138 +

a: 1.0.0

139 +

x: 1.0.1

140 +

next: 1.0.1

141 +

h: 1.0.1

142 +

(...and 3 more.)

119 143 120 144

published {TIME} ago

121 145

`

@@ -130,6 +154,18 @@ dist

130 154 131 155

dist-tags:

132 156

latest: 1.0.0

157 +

z: 1.0.0

158 +

y: 1.0.0

159 +

v1: 1.0.0

160 +

prev: 1.0.0

161 +

d: 1.0.0

162 +

c: 1.0.0

163 +

b: 1.0.0

164 +

a: 1.0.0

165 +

x: 1.0.1

166 +

next: 1.0.1

167 +

h: 1.0.1

168 +

(...and 3 more.)

133 169 134 170

published {TIME} ago

135 171

`

@@ -269,6 +305,18 @@ dist

269 305 270 306

dist-tags:

271 307

latest: 1.0.0

308 +

z: 1.0.0

309 +

y: 1.0.0

310 +

v1: 1.0.0

311 +

prev: 1.0.0

312 +

d: 1.0.0

313 +

c: 1.0.0

314 +

b: 1.0.0

315 +

a: 1.0.0

316 +

x: 1.0.1

317 +

next: 1.0.1

318 +

h: 1.0.1

319 +

(...and 3 more.)

272 320 273 321

published {TIME} ago

274 322

`

@@ -283,6 +331,18 @@ dist

283 331 284 332

dist-tags:

285 333

latest: 1.0.0

334 +

z: 1.0.0

335 +

y: 1.0.0

336 +

v1: 1.0.0

337 +

prev: 1.0.0

338 +

d: 1.0.0

339 +

c: 1.0.0

340 +

b: 1.0.0

341 +

a: 1.0.0

342 +

x: 1.0.1

343 +

next: 1.0.1

344 +

h: 1.0.1

345 +

(...and 3 more.)

286 346 287 347

published {TIME} ago

288 348

@@ -296,8 +356,20 @@ dist

296 356 297 357

dist-tags:

298 358

latest: 1.0.0

359 +

z: 1.0.0

360 +

y: 1.0.0

361 +

v1: 1.0.0

362 +

prev: 1.0.0

363 +

d: 1.0.0

364 +

c: 1.0.0

365 +

b: 1.0.0

366 +

a: 1.0.0

367 +

x: 1.0.1

368 +

next: 1.0.1

369 +

h: 1.0.1

370 +

(...and 3 more.)

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