Skip to content

Commit e861168

Browse files
authored
chore: fix release diff tag detection (#17331)
1 parent bed3faa commit e861168

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"@types/micromatch": "^4.0.7",
5555
"@types/node": "^20.12.12",
5656
"@types/picomatch": "^2.3.3",
57-
"@types/semver": "^7.5.8",
5857
"@types/stylus": "^0.48.42",
5958
"@types/ws": "^8.5.10",
6059
"@typescript-eslint/eslint-plugin": "^7.10.0",
@@ -75,7 +74,6 @@
7574
"prettier": "3.2.5",
7675
"rimraf": "^5.0.7",
7776
"rollup": "^4.13.0",
78-
"semver": "^7.6.2",
7977
"simple-git-hooks": "^2.11.1",
8078
"tslib": "^2.6.2",
8179
"tsx": "^4.11.0",

pnpm-lock.yaml

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/releaseUtils.ts

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { readdirSync, writeFileSync } from 'node:fs'
22
import path from 'node:path'
3-
import semver from 'semver'
43
import colors from 'picocolors'
54
import type { Options as ExecaOptions, ResultPromise } from 'execa'
65
import { execa } from 'execa'
@@ -15,15 +14,9 @@ export function run<EO extends ExecaOptions>(
1514
}
1615

1716
export async function getLatestTag(pkgName: string): Promise<string> {
18-
const tags = (await run('git', ['tag'], { stdio: 'pipe' })).stdout
19-
.split(/\n/)
20-
.filter(Boolean)
21-
const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@`
22-
return tags
23-
.filter((tag) => tag.startsWith(prefix))
24-
.sort((a, b) =>
25-
semver.rcompare(a.slice(prefix.length), b.slice(prefix.length)),
26-
)[0]
17+
const pkgJson = await fs.readJson(`packages/${pkgName}/package.json`)
18+
const version = pkgJson.version
19+
return pkgName === 'vite' ? `v${version}` : `${pkgName}@${version}`
2720
}
2821

2922
export async function logRecentCommits(pkgName: string): Promise<void> {

0 commit comments

Comments
 (0)