This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57fc618
commit d04d668
Showing
4 changed files
with
73 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This script can be removed as soon as official Windows arm64 builds are published: | ||
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342 | ||
|
||
$nodeVersion = $args[0] | ||
$fallbackVersion = $args[1] | ||
|
||
If ($null -eq $nodeVersion -Or $null -eq $fallbackVersion) { | ||
Write-Error "No NodeJS version given as argument to this file. Run it like download-nodejs-win-arm64.ps1 NODE_VERSION NODE_FALLBACK_VERSION" | ||
exit 1 | ||
} | ||
|
||
$url = "https://unofficial-builds.nodejs.org/download/release/v$nodeVersion/win-arm64/node.lib" | ||
$fallbackUrl = "https://unofficial-builds.nodejs.org/download/release/v$fallbackVersion/win-arm64/node.lib" | ||
|
||
# Always write to the $nodeVersion cache folder, even if we're using the fallbackVersion | ||
$cacheFolder = "$env:TEMP\prebuild\napi\$nodeVersion\arm64" | ||
|
||
If (!(Test-Path $cacheFolder)) { | ||
New-Item -ItemType Directory -Force -Path $cacheFolder | ||
} | ||
|
||
$output = "$cacheFolder\node.lib" | ||
$start_time = Get-Date | ||
|
||
Try { | ||
Invoke-WebRequest -Uri $url -OutFile $output | ||
$downloadedNodeVersion = $nodeVersion | ||
} Catch { | ||
If ($_.Exception.Response -And $_.Exception.Response.StatusCode -eq "NotFound") { | ||
Write-Output "No arm64 node.lib found for Node Windows $nodeVersion, trying fallback version $fallbackVersion..." | ||
Invoke-WebRequest -Uri $fallbackUrl -OutFile $output | ||
$downloadedNodeVersion = $fallbackVersion | ||
} | ||
} | ||
|
||
Write-Output "Downloaded arm64 NodeJS lib v$downloadedNodeVersion to $output in $((Get-Date).Subtract($start_time).Seconds) second(s)" |