chore: fix release diff tag detection (#17331)

This commit is contained in:
Bjorn Lu 2024-05-28 22:25:43 +08:00 committed by GitHub
parent bed3faa0cb
commit e861168f47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 18 deletions

View File

@ -54,7 +54,6 @@
"@types/micromatch": "^4.0.7",
"@types/node": "^20.12.12",
"@types/picomatch": "^2.3.3",
"@types/semver": "^7.5.8",
"@types/stylus": "^0.48.42",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.10.0",
@ -75,7 +74,6 @@
"prettier": "3.2.5",
"rimraf": "^5.0.7",
"rollup": "^4.13.0",
"semver": "^7.6.2",
"simple-git-hooks": "^2.11.1",
"tslib": "^2.6.2",
"tsx": "^4.11.0",

View File

@ -66,9 +66,6 @@ importers:
'@types/picomatch':
specifier: ^2.3.3
version: 2.3.3
'@types/semver':
specifier: ^7.5.8
version: 7.5.8
'@types/stylus':
specifier: ^0.48.42
version: 0.48.42
@ -129,9 +126,6 @@ importers:
rollup:
specifier: ^4.13.0
version: 4.13.0
semver:
specifier: ^7.6.2
version: 7.6.2
simple-git-hooks:
specifier: ^2.11.1
version: 2.11.1

View File

@ -1,6 +1,5 @@
import { readdirSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import semver from 'semver'
import colors from 'picocolors'
import type { Options as ExecaOptions, ResultPromise } from 'execa'
import { execa } from 'execa'
@ -15,15 +14,9 @@ export function run<EO extends ExecaOptions>(
}
export async function getLatestTag(pkgName: string): Promise<string> {
const tags = (await run('git', ['tag'], { stdio: 'pipe' })).stdout
.split(/\n/)
.filter(Boolean)
const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@`
return tags
.filter((tag) => tag.startsWith(prefix))
.sort((a, b) =>
semver.rcompare(a.slice(prefix.length), b.slice(prefix.length)),
)[0]
const pkgJson = await fs.readJson(`packages/${pkgName}/package.json`)
const version = pkgJson.version
return pkgName === 'vite' ? `v${version}` : `${pkgName}@${version}`
}
export async function logRecentCommits(pkgName: string): Promise<void> {