cli
cli copied to clipboard
[DOCS] cryptic npm view labels
Is there an existing issue for this?
- [X] I have searched the existing issues
This is a CLI Docs Enhancement, not another kind of Docs Enhancement.
- [X] This is a CLI Docs Enhancement.
Description of Problem
So docs say that we can extract certain info about package. eg. I can do
npm view express contributors
which returns a array of strings containing name and email of a contributor like so
<name email>
I can also do (using hidden magic labels)
npm view express contributors.email
to view contributors emails
What I am trying to do is extracting exact publish time of given package version. I have tried all the magic labels that come up to my mind like time, datetime, tag etc.
After digging up in the repo I have found those magic labels for contributors. https://github.com/npm/cli/blob/2953983ad5c5e830a5844be5d6d0a2b49863c05d/lib/commands/view.js#L510-L514
Unfortunately there is only a minor mention of time property in referenced file https://github.com/npm/cli/blob/2953983ad5c5e830a5844be5d6d0a2b49863c05d/lib/commands/view.js#L349-L350
following this notation in cli gives no results
npm view express time.'4.17.1']
or 'no matches found:'
npm view express time['4.17.1']
Potential Solution
Add info about labels to docs
Docs URL
https://docs.npmjs.com/cli/v8/commands/npm-view
After playing around with it, it looks like npm view express "time[4.17.1]"
will work. I agree that the docs need improved.
Not npm view [email protected] time
?
It returns the key value pairs of [version]: [datetime] for all releases.