Skip to content

Commit a68304a

Browse files
authored
Merge pull request #938 from Gijsreyn/add-nodejs
Add NodeJS to build script
2 parents 9903df4 + c68c44e commit a68304a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

build.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,27 @@ if ($null -ne $packageType) {
172172
$BuildToolsPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC"
173173

174174
& $rustup default stable
175+
176+
## Test if Node is installed
177+
## Skipping upgrade as users may have a specific version they want to use
178+
if (!(Get-Command 'node' -ErrorAction Ignore)) {
179+
Write-Verbose -Verbose "Node.js not found, installing..."
180+
if (!$IsWindows) {
181+
if (Get-Command 'brew' -ErrorAction Ignore) {
182+
brew install node@24
183+
} else {
184+
Write-Warning "Homebrew not found, please install Node.js manually"
185+
}
186+
}
187+
else {
188+
if (Get-Command 'winget' -ErrorAction Ignore) {
189+
Write-Verbose -Verbose "Using winget to install Node.js"
190+
winget install OpenJS.NodeJS --accept-source-agreements --accept-package-agreements --source winget --silent
191+
} else {
192+
Write-Warning "winget not found, please install Node.js manually"
193+
}
194+
}
195+
}
175196
}
176197

177198
if (!$SkipBuild -and !$SkipLinkCheck -and $IsWindows -and !(Get-Command 'link.exe' -ErrorAction Ignore)) {

0 commit comments

Comments
 (0)