diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2022-02-03 08:16:56 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2022-02-03 22:28:22 +0300 |
commit | ebb428375cd417c096d5a648df92620dc4215a3d (patch) | |
tree | 138e9959744d9bff0808393e275a8062aaf8f79e /lib/commands | |
parent | c0519edc16f66370b2153430342247b4ec5cb496 (diff) |
fix(outdated): parse aliased modules
Fixes `npm outdated` to properly parse and display info on aliased
packages.
Fixes: https://github.com/npm/cli/issues/2800
Diffstat (limited to 'lib/commands')
-rw-r--r-- | lib/commands/outdated.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/commands/outdated.js b/lib/commands/outdated.js index e1a6f8150..0cb5b4247 100644 --- a/lib/commands/outdated.js +++ b/lib/commands/outdated.js @@ -193,7 +193,12 @@ class Outdated extends ArboristWorkspaceCmd { } async getOutdatedInfo (edge) { - const spec = npa(edge.name) + let alias = false + try { + alias = npa(edge.spec).subSpec + } catch (err) { + } + const spec = npa(alias ? alias.name : edge.name) const node = edge.to || edge const { path, location } = node const { version: current } = node.package || {} @@ -217,7 +222,7 @@ class Outdated extends ArboristWorkspaceCmd { try { const packument = await this.getPackument(spec) - const expected = edge.spec + const expected = alias ? alias.fetchSpec : edge.spec // if it's not a range, version, or tag, skip it try { if (!npa(`${edge.name}@${edge.spec}`).registry) { @@ -239,7 +244,7 @@ class Outdated extends ArboristWorkspaceCmd { : 'global' this.list.push({ - name: edge.name, + name: alias ? edge.spec.replace('npm', edge.name) : edge.name, path, type, current, |