Skip to content

Commit

Permalink
fix(view): fix non-registry specs
Browse files Browse the repository at this point in the history
This was working by coincidence in 7.7.6 and before, and broken in the
7.8.0 refactor.  Before, it would see there was no "name" in the spec,
and then read your local package.json, and from that get a `latest`
tag.  So, if you didn't have a package.json in your CWD it would fail
with an ENOENT trying to read it.

This fixes it for real, so that if you aren't asking for info from a
registry spec, it goes ahead and looks for the `latest` tag (or whatever
tag you have configured as your default).
  • Loading branch information
wraithgar committed May 7, 2021
1 parent 049166b commit 76b445a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ class View extends BaseCommand {
const spec = npa(pkg)

// get the data about this package
let version = spec.rawSpec || this.npm.config.get('tag')
let version = this.npm.config.get('tag')
// rawSpec is only a version if this is a registry spec
if (spec.type === 'registry' && spec.rawSpec)
version = spec.rawSpec

const pckmnt = await packument(spec, opts)

Expand Down

0 comments on commit 76b445a

Please sign in to comment.