diff options
author | Gar <gar+gh@danger.computer> | 2021-05-07 19:41:55 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-11 00:04:17 +0300 |
commit | 0696fca13d10726e04ca97ff50eef7bd7455a3ab (patch) | |
tree | 8d733f67efbdba5232b6cb47bf5ee2454525580f /lib | |
parent | f3a662fcd869653f9753aef3d40cc96ed28ed509 (diff) |
fix(view): fix non-registry specs
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 are asking for info from a git spec, it
goes ahead and looks for the `latest` tag (or whatever tag you have configured
as your default).
PR-URL: https://github.com/npm/cli/pull/3209
Credit: @wraithgar
Close: #3209
Reviewed-by: @ruyadorno
Diffstat (limited to 'lib')
-rw-r--r-- | lib/view.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/view.js b/lib/view.js index 91b32e2fd..9cc1aed91 100644 --- a/lib/view.js +++ b/lib/view.js @@ -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 the git url if this is from git + if (spec.type !== 'git' && spec.rawSpec) + version = spec.rawSpec const pckmnt = await packument(spec, opts) |