mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Juke Build * Done * Done 2 * Test * Update * build chmod+x I hate linux so much its stupid * build chmod+x I hate linux so much its stupid 2 * e * update * Lets see what happens * NICE * Update build * GOD SAKE * :[ * YEET * Update .gitignore * Delete tgui-common.bundle.js * Delete tgui-polyfill.min.js * Revert "Delete tgui-polyfill.min.js" This reverts commit5446645db0. * Revert "Delete tgui-common.bundle.js" This reverts commit206377aaea. * Delete tgui-common.bundle.js
59 lines
1.6 KiB
PowerShell
59 lines
1.6 KiB
PowerShell
## bootstrap/node_.ps1
|
|
## Downloads a Node version to a cache directory and invokes it.
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
function Extract-Variable {
|
|
param([string] $Path, [string] $Key)
|
|
foreach ($Line in Get-Content $Path) {
|
|
if ($Line.StartsWith("export $Key=")) {
|
|
return $Line.Substring("export $Key=".Length)
|
|
}
|
|
}
|
|
throw "Couldn't find value for $Key in $Path"
|
|
}
|
|
|
|
function Download-Node {
|
|
if (Test-Path $NodeTarget -PathType Leaf) {
|
|
return
|
|
}
|
|
Write-Output "Downloading Node v$NodeVersion (may take a while)"
|
|
New-Item $NodeTargetDir -ItemType Directory -ErrorAction silentlyContinue | Out-Null
|
|
$WebClient = New-Object Net.WebClient
|
|
$WebClient.DownloadFile($NodeSource, $NodeTarget)
|
|
}
|
|
|
|
## Convenience variables
|
|
$BaseDir = Split-Path $script:MyInvocation.MyCommand.Path
|
|
$Cache = "$BaseDir\.cache"
|
|
if ($Env:TG_BOOTSTRAP_CACHE) {
|
|
$Cache = $Env:TG_BOOTSTRAP_CACHE
|
|
}
|
|
$NodeVersion = Extract-Variable -Path "$BaseDir\..\..\dependencies.sh" -Key "NODE_VERSION_PRECISE"
|
|
$NodeSource = "https://nodejs.org/download/release/v$NodeVersion/win-x64/node.exe"
|
|
$NodeTargetDir = "$Cache\node-v$NodeVersion-x64"
|
|
$NodeTarget = "$NodeTargetDir\node.exe"
|
|
|
|
## Just print the path and exit
|
|
if ($Args.length -eq 1 -and $Args[0] -eq "Get-Path") {
|
|
Write-Output "$NodeTargetDir"
|
|
exit 0
|
|
}
|
|
|
|
## Just download node and exit
|
|
if ($Args.length -eq 1 -and $Args[0] -eq "Download-Node") {
|
|
Download-Node
|
|
exit 0
|
|
}
|
|
|
|
## Download node
|
|
Download-Node
|
|
|
|
## Set PATH so that recursive calls find it
|
|
$Env:PATH = "$NodeTargetDir;$ENV:Path"
|
|
|
|
## Invoke Node with all command-line arguments
|
|
$ErrorActionPreference = "Continue"
|
|
& "$NodeTarget" @Args
|
|
exit $LastExitCode
|