Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the information time object output by npm view should sorted b… #7807

Open
wants to merge 2 commits into
base: latest
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/commands/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ class View extends BaseCommand {
log.info('view', `Ignoring invalid version: ${v}`)
return false
}).sort(semver.compareLoose)
const pckmntTime = {}
const invalidVersions = Object.keys(pckmnt.time).filter(v => !semver.valid(v))
invalidVersions.forEach(v => {
pckmntTime[v] = pckmnt.time[v]
})
pckmnt.versions.forEach(v => {
pckmntTime[v] = pckmnt.time[v]
})
pckmnt.time = pckmntTime
btea marked this conversation as resolved.
Show resolved Hide resolved

// remove readme unless we asked for it
if (args.indexOf('readme') === -1) {
Expand Down