chore: avoid unncessary print on release script exit [ci skip]

This commit is contained in:
Evan You 2023-10-20 11:47:56 +08:00
parent 9058853411
commit e5844aafb6
1 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,8 @@ import { execa } from 'execa'
import { createRequire } from 'node:module'
import { fileURLToPath } from 'node:url'
let versionUpdated = false
const { prompt } = enquirer
const currentVersion = createRequire(import.meta.url)('../package.json').version
const __dirname = path.dirname(fileURLToPath(import.meta.url))
@ -219,6 +221,7 @@ async function main() {
targetVersion,
isCanary ? renamePackageToCanary : keepThePackageName
)
versionUpdated = true
// build all packages with types
step('\nBuilding all packages...')
@ -418,7 +421,10 @@ async function publishPackage(pkgName, version) {
}
main().catch(err => {
updateVersions(currentVersion)
if (versionUpdated) {
// revert to current version on failed releases
updateVersions(currentVersion)
}
console.error(err)
process.exit(1)
})