mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Windows] Rename image build scripts (#8808)
This commit is contained in:
committed by
GitHub
parent
f78a7baa80
commit
0263bdd53e
32
images/windows/scripts/build/Install-NodeJS.ps1
Normal file
32
images/windows/scripts/build/Install-NodeJS.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
################################################################################
|
||||
## File: Install-NodeJS.ps1
|
||||
## Desc: Install nodejs-lts and other common node tools.
|
||||
## Must run after python is configured
|
||||
################################################################################
|
||||
|
||||
$PrefixPath = 'C:\npm\prefix'
|
||||
$CachePath = 'C:\npm\cache'
|
||||
|
||||
New-Item -Path $PrefixPath -Force -ItemType Directory
|
||||
New-Item -Path $CachePath -Force -ItemType Directory
|
||||
|
||||
$defaultVersion = (Get-ToolsetContent).node.default
|
||||
$versionToInstall = Get-LatestChocoPackageVersion -TargetVersion $defaultVersion -PackageName "nodejs"
|
||||
|
||||
Choco-Install -PackageName nodejs -ArgumentList "--version=$versionToInstall"
|
||||
|
||||
Add-MachinePathItem $PrefixPath
|
||||
$env:Path = Get-MachinePath
|
||||
|
||||
setx npm_config_prefix $PrefixPath /M
|
||||
$env:npm_config_prefix = $PrefixPath
|
||||
|
||||
npm config set cache $CachePath --global
|
||||
npm config set registry https://registry.npmjs.org/
|
||||
|
||||
$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
|
||||
$globalNpmPackages | ForEach-Object {
|
||||
npm install -g $_.name
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "Node"
|
||||
Reference in New Issue
Block a user