mirror of
https://github.com/danbulant/deno_install
synced 2026-06-17 05:21:32 +00:00
45 lines
949 B
PowerShell
Executable file
45 lines
949 B
PowerShell
Executable file
#!/usr/bin/env pwsh
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if ($PSVersionTable.PSEdition -ne 'Core') {
|
|
$IsWindows = $true
|
|
}
|
|
|
|
if (!(Get-PSRepository)) {
|
|
Register-PSRepository -Default
|
|
}
|
|
|
|
if (!(Get-Module PSScriptAnalyzer -ListAvailable)) {
|
|
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
|
|
}
|
|
|
|
# Lint.
|
|
Invoke-ScriptAnalyzer *.ps1 -EnableExit -Exclude PSAvoidAssignmentToAutomaticVariable
|
|
|
|
$BinDir = if ($IsWindows) {
|
|
"$Home\.deno\bin"
|
|
} else {
|
|
"$Home/.deno/bin"
|
|
}
|
|
|
|
# Test we can install a specific version.
|
|
Remove-Item $BinDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
.\install.ps1 v0.3.10
|
|
$DenoVersion = if ($IsWindows) {
|
|
deno version
|
|
} else {
|
|
~/.deno/bin/deno version
|
|
}
|
|
if (!($DenoVersion -like '*0.3.10*')) {
|
|
throw $DenoVersion
|
|
}
|
|
|
|
# Test we can install the latest version.
|
|
Remove-Item $BinDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
.\install.ps1
|
|
if ($IsWindows) {
|
|
deno version
|
|
} else {
|
|
~/.deno/bin/deno version
|
|
}
|