Skip to content

Commit

Permalink
chore: refactor the version counting method:
Browse files Browse the repository at this point in the history
  • Loading branch information
permaficus committed Jun 12, 2024
1 parent 7883e9e commit f69260b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/libs/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ export const updateVersion = async (args: UpdateArguments): Promise<void> => {
const splitVersion = pkgJson.version.split(".");
let version: string;
let [major, minor, build] = [+splitVersion[0], +splitVersion[1], +splitVersion[2]];

build >=0 && build < args.buildMax ? build++ : build = 1;
build === args.buildMax ? minor++ : null;
minor > args.minorMax ? major++ : null;
minor === (args.minorMax + 1) ? minor = 0 : null

build++;
if (build > args.buildMax) {
minor++;
build = 1;
}
if (minor > args.minorMax) {
major++;
minor = 1;
}

version = `${major}.${minor}.${build}`
pkgJson.version = version
Expand Down

0 comments on commit f69260b

Please sign in to comment.