Skip to content

Commit

Permalink
Simplify VM-Install-Node-Tool-From-Zip code
Browse files Browse the repository at this point in the history
Simplify the code of the `VM-Install-Node-Tool-From-Zip` function helper
and keep it consistent with the recently introduced helper function:
`VM-Install-Node-Tool`
  • Loading branch information
Ana06 committed May 15, 2024
1 parent 349fb4f commit 72758d6
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,10 @@ function VM-Install-Node-Tool-From-Zip {
[Parameter(Mandatory=$false)]
[bool] $innerFolder=$true # Default to true as most node apps are GH repos (ZIP with inner folder)
)
# Install dependencies with npm when running shortcut as we ignore errors below
$powershellCommand = "npm install; node $command"
$toolDir = (VM-Install-From-Zip $toolName $category $zipUrl $zipSha256 -innerFolder $innerFolder -powershellCommand "node $command")[0]

$toolDir = (VM-Install-From-Zip $toolName $category $zipUrl $zipSha256 -innerFolder $innerFolder -powershellCommand $powershellCommand)[0]

# Prevent the following warning from failing the package: "npm WARN deprecated [email protected]"
$ErrorActionPreference = 'Continue'
# Get absolute path as npm may not be in PATH until Powershell is restarted
$npmPath = Join-Path ${Env:ProgramFiles} "\nodejs\npm.cmd" -Resolve
# Install tool dependencies with npm
Set-Location $toolDir; & "$npmPath" install | Out-Null
Set-Location $toolDir; npm install --no-update-notifier
}

# This functions returns $executablePath
Expand Down

0 comments on commit 72758d6

Please sign in to comment.