From 47eac694dc7dfd19f3bc525c03c5de995e171c8e Mon Sep 17 00:00:00 2001 From: Ovilia Date: Wed, 25 Jun 2025 17:30:03 +0800 Subject: [PATCH] chore: allow rc version check for npm release --- build/prepublish.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/prepublish.js b/build/prepublish.js index d15ab870c..b02f8006a 100644 --- a/build/prepublish.js +++ b/build/prepublish.js @@ -30,11 +30,15 @@ const fileVersions = [ }); const versions = fileVersions.map(({ file, version }) => { - console.log(` ∟ The version in [${chalk.blueBright(file)}] is ${chalk.cyanBright.bold(version)}`); + const color = version.indexOf('rc') > -1 ? chalk.magenta : chalk.cyanBright; + console.log(` ∟ The version in [${chalk.blueBright(file)}] is ${color.bold(version)}`); return version; }); -if (new Set(versions).size !== 1) { +// Ignore rc because when releasing an rc version on npm, +// the version in package.json contains -rc.x while src doesn't. +const versionPrefixes = versions.map(version => version.split('-rc')[0]); +if (new Set(versionPrefixes).size !== 1) { console.log(); console.error(chalk.red('❌ Version does not match! Please check and rerun the release script via:')); console.log();