Skip to content

[DOCS] cryptic npm view labels #5526

@moonith

Description

@moonith

Is there an existing issue for this?

  • I have searched the existing issues

This is a CLI Docs Enhancement, not another kind of Docs Enhancement.

  • 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.

cli/lib/commands/view.js

Lines 510 to 514 in 2953983

function unparsePerson (d) {
return d.name +
(d.email ? ' <' + d.email + '>' : '') +
(d.url ? ' (' + d.url + ')' : '')
}

Unfortunately there is only a minor mention of time property in referenced file

cli/lib/commands/view.js

Lines 349 to 350 in 2953983

modified: !packument.time ? undefined
: chalk.yellow(relativeDate(packument.time[manifest.version])),

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issuePriority 2secondary priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions