Skip to content

Commit

Permalink
Update bump-version.js
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Apr 26, 2023
1 parent dfecfc0 commit f8b7717
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions build/bump-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,29 @@ function bumpNpmVersion(newVersion) {
})
}

function showUsage(args) {
console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
console.error('Got arguments:', args)
process.exit(1)
}

async function main(args) {
let [oldVersion, newVersion] = args

if (!oldVersion || !newVersion || (oldVersion === newVersion)) {
console.error('USAGE: bump-version old_version new_version [--verbose] [--dry[-run]]')
console.error('Got arguments:', args)
process.exit(1)
if (!oldVersion || !newVersion) {
showUsage(args)
}

// Strip any leading `v` from arguments because otherwise we will end up with duplicate `v`s
// Strip any leading `v` from arguments because
// otherwise we will end up with duplicate `v`s
[oldVersion, newVersion] = [oldVersion, newVersion].map(arg => {
return arg.startsWith('v') ? arg.slice(1) : arg
})

if (oldVersion === newVersion) {
showUsage(args)
}

bumpNpmVersion(newVersion)

try {
Expand Down

0 comments on commit f8b7717

Please sign in to comment.