Skip to content

Commit

Permalink
Update set-dev-version.js
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored Jan 3, 2021
1 parent 14bcd15 commit 3119382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/set-dev-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

const fs = require('fs');

// Leading `0` aren't valid semver, so we round it up to 10 to
// avoid having to change the nightly version format.
function roundToTen(value) {
return value < 10 ? 10 : value;
}

function leftPad(value) {
return (value < 10 ? '0' : '') + value;
}
Expand All @@ -18,7 +24,7 @@ const formattedDate =
leftPad(date.getUTCMonth() + 1) +
leftPad(date.getUTCDate()) +
'.' +
leftPad(date.getUTCHours()) +
leftPad(roundToTen(date.getUTCHours())) +
leftPad(date.getUTCMinutes());

// Remove any existing suffix before appending the date
Expand All @@ -30,4 +36,5 @@ fs.writeFileSync(
packageManifestFilename,
JSON.stringify(packageManifest, null, 2) + '\n'
);

console.log('Updated version number to ' + version);

0 comments on commit 3119382

Please sign in to comment.