代码拉取完成,页面将自动刷新
#!/usr/bin/env pwsh
# Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
# TODO(everyone): Keep this script simple and easily auditable.
$ErrorActionPreference = 'Stop'
if ($v) {
$Version = "${v}"
}
if ($args.Length -eq 1) {
$Version = $args.Get(0)
}
$DenoInstall = $env:DENO_INSTALL
$BinDir = if ($DenoInstall) {
"$DenoInstall\bin"
} else {
"$Home\.deno\bin"
}
$DenoZip = "$BinDir\deno.zip"
$DenoExe = "$BinDir\deno.exe"
$Target = 'x86_64-pc-windows-msvc'
# GitHub requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (!$Version) {
$Version = (Invoke-WebRequest 'https://dl.deno.js.cn/release-latest.txt' -UseBasicParsing).Content.Trim()
}
$Version = $Version.Replace("v","")
$DownloadUrl = "https://dl.deno.js.cn/release/v${Version}/deno-${Target}.zip"
if (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}
curl.exe -Lo $DenoZip $DownloadUrl
tar.exe xf $DenoZip -C $BinDir
Remove-Item $DenoZip
$User = [EnvironmentVariableTarget]::User
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User)
$Env:Path += ";$BinDir"
}
Write-Output "Deno 已经成功安装"
Write-Output "可执行文件位置为 $DenoExe"
Write-Output "运行 'deno --help' 查看 Deno 帮助信息"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。