pnpm: Add checkver script that checks all release tags (#3667)

* pnpm: Add checkver script that checks all releases

* adjust comment
This commit is contained in:
Issac Lin 2022-06-13 01:53:02 +08:00 committed by GitHub
parent 75b61d3bc1
commit 355d9f3613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,20 @@
},
"bin": "pnpm.exe",
"checkver": {
"github": "https://github.com/pnpm/pnpm"
"script": [
"# Using checkver script to check through all release tags",
"$url = 'https://api.github.com/repos/pnpm/pnpm/releases'",
"$latest_ver = [Version]::new(0,0,0,0) # note: Powershell 5 does not support casting 'int' or 'float' to 'System.Version'",
"$releases = $(Invoke-WebRequest $url).Content | ConvertFrom-Json",
"$releases | ForEach-Object {",
" if (!($_.tag_name -match '([\\d.]+)')) { return }",
" $ver = [Version]::new($matches[1])",
" if ($ver -gt $latest_ver) { $latest_ver = $ver }",
"}",
"if ($latest_ver -eq [Version]::new(0,0,0,0)) { error \"Could not match version string in '$url'\"; break }",
"Write-Output $latest_ver"
],
"regex": "([\\d.]+)"
},
"autoupdate": {
"url": "https://github.com/pnpm/pnpm/releases/download/v$version/pnpm-win-x64.exe#/pnpm.exe"