Skip to content

Commit

Permalink
build: add beta
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Apr 4, 2024
1 parent 8663b94 commit 8f5f70f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ let {
// (semver.prerelease(currentVersion) && semver.prerelease(currentVersion)[0])
const EXPECTED_BRANCH = 'v2'

const incrementVersion = (increment) =>
semver.inc(currentVersion, increment, preId)
const bin = (name) => resolve(__dirname, '../node_modules/.bin/' + name)
/**
* @param bin {string}
Expand Down Expand Up @@ -137,6 +135,11 @@ async function main() {
message: `Select release type for ${chalk.bold.white(name)}`,
choices: versionIncrements
.map((i) => `${i}: ${name} (${semver.inc(version, i, preId)})`)
.concat(
optionTag === 'beta'
? [`beta: ${name} (${semver.inc(version, 'prerelease', 'beta')})`]
: []
)
.concat(['custom']),
})

Expand Down Expand Up @@ -176,10 +179,8 @@ async function main() {
return
}

if (!noDepsUpdate) {
step('\nUpdating versions in package.json files...')
await updateVersions(pkgWithVersions)
}
step('\nUpdating versions in package.json files...')
await updateVersions(pkgWithVersions)

step('\nUpdating lock...')
await runIfNotDry(`pnpm`, ['install'])
Expand Down Expand Up @@ -260,8 +261,10 @@ async function updateVersions(packageList) {
return Promise.all(
packageList.map(({ pkg, version, path, name }) => {
pkg.version = version
updateDeps(pkg, 'dependencies', packageList)
updateDeps(pkg, 'peerDependencies', packageList)
if (!noDepsUpdate) {
updateDeps(pkg, 'dependencies', packageList)
updateDeps(pkg, 'peerDependencies', packageList)
}
const content = JSON.stringify(pkg, null, 2) + '\n'
return isDryRun
? dryRun('write', [name], {
Expand Down

0 comments on commit 8f5f70f

Please sign in to comment.