From 2486d991f19aa362b0d42c44e2875e784c133a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sat, 10 Feb 2024 14:10:16 +0800 Subject: [PATCH] chore: fix release vapor --- scripts/release.js | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index 416e72d4f..07ab625aa 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -163,24 +163,26 @@ async function main() { const pkgName = isCanary ? renamePackageToCanary('vue') : renamePackageToVapor('vue') - const { stdout } = await run( - 'pnpm', - ['view', `${pkgName}@~${newVersion}`, 'version', '--json'], - { stdio: 'pipe' }, - ) - let versions = JSON.parse(stdout) - versions = Array.isArray(versions) ? versions : [versions] - const latestSameDayPatch = /** @type {string} */ ( - semver.maxSatisfying(versions, `~${newVersion}`) - ) - - newVersion = /** @type {string} */ ( - semver.inc(latestSameDayPatch, 'patch') - ) - if (args.tag && args.tag !== 'latest') { - newVersion = /** @type {string} */ ( - semver.inc(latestSameDayPatch, 'prerelease', args.tag) + if (isCanary) { + const { stdout } = await run( + 'pnpm', + ['view', `${pkgName}@~${newVersion}`, 'version', '--json'], + { stdio: 'pipe' }, ) + let versions = JSON.parse(stdout) + versions = Array.isArray(versions) ? versions : [versions] + const latestSameDayPatch = /** @type {string} */ ( + semver.maxSatisfying(versions, `~${newVersion}`) + ) + + newVersion = /** @type {string} */ ( + semver.inc(latestSameDayPatch, 'patch') + ) + if (args.tag && args.tag !== 'latest') { + newVersion = /** @type {string} */ ( + semver.inc(latestSameDayPatch, 'prerelease', args.tag) + ) + } } } catch (/** @type {any} */ e) { if (/E404/.test(e.message)) {