diff --git a/package.json b/package.json index 569d01a959082f..4ef3245508997f 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@types/micromatch": "^4.0.5", "@types/node": "^20.9.0", "@types/picomatch": "^2.3.3", + "@types/semver": "^7.5.4", "@types/sass": "~1.43.1", "@types/stylus": "^0.48.42", "@types/ws": "^8.5.9", @@ -80,6 +81,7 @@ "prettier": "3.1.0", "rimraf": "^5.0.5", "rollup": "^4.2.0", + "semver": "^7.5.4", "simple-git-hooks": "^2.9.0", "tslib": "^2.6.2", "tsx": "^4.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 22890b58e65a64..6abe42374ed1ed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,6 +81,9 @@ importers: '@types/sass': specifier: ~1.43.1 version: 1.43.1 + '@types/semver': + specifier: ^7.5.4 + version: 7.5.4 '@types/stylus': specifier: ^0.48.42 version: 0.48.42 @@ -144,6 +147,9 @@ importers: rollup: specifier: ^4.2.0 version: 4.2.0 + semver: + specifier: ^7.5.4 + version: 7.5.4 simple-git-hooks: specifier: ^2.9.0 version: 2.9.0 @@ -3956,8 +3962,8 @@ packages: '@types/node': 20.9.0 dev: true - /@types/semver@7.5.0: - resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} + /@types/semver@7.5.4: + resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==} dev: true /@types/stylus@0.48.42: @@ -4088,7 +4094,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.53.0) '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 + '@types/semver': 7.5.4 '@typescript-eslint/scope-manager': 6.10.0 '@typescript-eslint/types': 6.10.0 '@typescript-eslint/typescript-estree': 6.10.0(typescript@5.2.2) @@ -7182,11 +7188,6 @@ packages: dependencies: yallist: 4.0.0 - /lru-cache@9.1.2: - resolution: {integrity: sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==} - engines: {node: 14 || >=16.14} - dev: true - /magic-string@0.27.0: resolution: {integrity: sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==} engines: {node: '>=12'} @@ -7801,7 +7802,7 @@ packages: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: - lru-cache: 9.1.2 + lru-cache: 10.0.1 minipass: 5.0.0 dev: true diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts index 3f4acd96eb1213..1037b035a3c94d 100644 --- a/scripts/releaseUtils.ts +++ b/scripts/releaseUtils.ts @@ -1,5 +1,6 @@ import { readdirSync, writeFileSync } from 'node:fs' import path from 'node:path' +import semver from 'semver' import colors from 'picocolors' import type { Options as ExecaOptions, ExecaReturnValue } from 'execa' import { execa } from 'execa' @@ -20,8 +21,9 @@ export async function getLatestTag(pkgName: string): Promise { const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@` return tags .filter((tag) => tag.startsWith(prefix)) - .sort((a, b) => a.localeCompare(b, 'en', { numeric: true })) - .reverse()[0] + .sort((a, b) => + semver.rcompare(a.slice(prefix.length), b.slice(prefix.length)), + )[0] } export async function logRecentCommits(pkgName: string): Promise {