From 55c56d53f4684db4781542ad81812d1d37fbea11 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 26 Jun 2020 19:59:26 +0000 Subject: [PATCH] Update version bump to make it smart --- script/version_bump.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/script/version_bump.js b/script/version_bump.js index e38ff4dae6..197dca4196 100755 --- a/script/version_bump.js +++ b/script/version_bump.js @@ -16,14 +16,31 @@ function today() { )}${String(now.getDate()).padStart(2, "0")}.0`; } +function auto(version) { + const todayVersion = today(); + if (todayVersion !== version) { + return todayVersion; + } + return patch(version); +} + const methods = { patch, today, + auto, }; async function main(args) { - const method = args.length > 0 && methods[args[0]]; - const commit = args.length > 1 && args[1] == "--commit"; + let method; + let commit; + + if (args.length === 0) { + method = methods.auto; + commit = true; + } else { + method = args.length > 0 && methods[args[0]]; + commit = args.length > 1 && args[1] == "--commit"; + } if (!method) { console.error(