Skip to content

Commit 2af771d

Browse files
committed
Add NodeJS to build script
1 parent 9903df4 commit 2af771d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

build.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ 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+
if (!(Get-Command 'node' -ErrorAction Ignore)) {
178+
Write-Verbose -Verbose "Node.js not found, installing..."
179+
if (!$IsWindows) {
180+
if (Get-Command 'brew' -ErrorAction Ignore) {
181+
brew install node@24
182+
} else {
183+
Write-Warning "Homebrew not found, please install Node.js manually"
184+
}
185+
}
186+
else {
187+
if (Get-Command 'winget' -ErrorAction Ignore) {
188+
Write-Verbose -Verbose "Using winget to install Node.js"
189+
& winget install OpenJS.NodeJS --accept-source-agreements --accept-package-agreements --source winget
190+
} else {
191+
Write-Warning "winget not found, please install Node.js manually"
192+
}
193+
}
194+
}
175195
}
176196

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

0 commit comments

Comments
 (0)