fix: npm view should respect configured registry when checking version
This commit is contained in:
+2
-1
@@ -227,7 +227,8 @@ function Detect-Installed {
|
|||||||
function Get-RemoteNpmVersion {
|
function Get-RemoteNpmVersion {
|
||||||
if (-not (Get-Command "npm" -ErrorAction SilentlyContinue)) { return $null }
|
if (-not (Get-Command "npm" -ErrorAction SilentlyContinue)) { return $null }
|
||||||
try {
|
try {
|
||||||
$ver = (& npm view $script:NPM_PACKAGE version 2>$null).Trim()
|
$regArg = if ($script:NPM_REGISTRY -and $script:NPM_REGISTRY -ne "https://registry.npmjs.org") { "--registry=$($script:NPM_REGISTRY)" } else { "" }
|
||||||
|
$ver = (& npm view $script:NPM_PACKAGE version $regArg 2>$null).Trim()
|
||||||
if ($ver) { return $ver }
|
if ($ver) { return $ver }
|
||||||
} catch {}
|
} catch {}
|
||||||
return $null
|
return $null
|
||||||
|
|||||||
Reference in New Issue
Block a user