Skip to content

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

Open
btea wants to merge 2 commits into
npm:latestfrom
btea:fix/npm-view-time-sort-version
Open

fix: the information time object output by npm view should sorted b…#7807
btea wants to merge 2 commits into
npm:latestfrom
btea:fix/npm-view-time-sort-version

Conversation

@btea

@btea btea commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

…y version

When I execute npm view --json in my local project, the output is as follows:

before after
image image

References

@btea btea requested a review from a team as a code owner October 2, 2024 09:52
Comment thread lib/commands/view.js Outdated
@wraithgar

wraithgar commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

I'm not so sure about this, --json is for computer parsing, not human reading. We do sort the results in what's called the prettyView.

I do have a PR underway to sort the tags by publish date, and to truncate them, so that the pretty view is more useful at a glance. It will be part of npm 11.

ETA: I guess we already sort the versions in this display, so the cat's out of the bag there. It still seems silly formatting json for human display.

@wraithgar

Copy link
Copy Markdown
Contributor

Draft PR for the pretty view change #7808

@ljharb

ljharb commented Oct 3, 2024

Copy link
Copy Markdown
Contributor

It does also potentially help programmatic use cases, the majority of which might want them in semver order anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants