Skip to content

Get the package.json of a package from the npm registry

License

Notifications You must be signed in to change notification settings

sindresorhus/package-json-cli

Repository files navigation

package-json-cli

Get the package.json of a package from the npm registry

Install

npm install --global package-json-cli

Usage

$ package-json --help

  Usage
    $ package-json <name> [version=latest]

  Options
    --full-metadata  Output full package metadata
    --all-versions   Output all versions
    --registry-url   Custom registry URL
    --no-deprecated  Omit deprecated versions

  Example
    $ package-json ava
    {
      "name": "ava",
      "version": "6.1.1"
      …
    }

The version can be in any format supported by the semver module. For example:

  • 1 - get the latest 1.x.x
  • 1.2 - get the latest 1.2.x
  • ^1.2.3 - get the latest 1.x.x but at least 1.2.3

Dist tags (such as latest) are also supported.

Related