1 Star 6 Fork 0

justjavac / deno

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
install.ps1 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
justjavac 提交于 2022-08-15 16:25 . 在 ps1 中使用 curl 和 tar (#21)
#!/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 帮助信息"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/justjavac/deno.git
git@gitee.com:justjavac/deno.git
justjavac
deno
deno
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891