Skip to content

Commit

Permalink
Use proper semver prerelease tag
Browse files Browse the repository at this point in the history
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
  • Loading branch information
guw committed Jul 18, 2023
1 parent b737bcc commit 07bbcf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,19 @@ gulp.task('build_or_download', function (done) {
});

gulp.task('prepare_pre_release', function (done) {
const stableVersion = packageJson.version.match(/(\d+)\.(\d+)\.(\d+)/);
// parse existing version (using ECMA script regex from https://semver.org/)
const stableVersion = packageJson.version.match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/);
const major = stableVersion[1];
const minor = stableVersion[2];
const patch = stableVersion[3];
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
const hours = date.getHours();
const minutes = date.getMinutes();
const patch = `${date.getFullYear()}${prependZero(month)}${prependZero(day)}${prependZero(hours)}${prependZero(minutes)}`;
const prerelease = `preview${date.getFullYear()}${prependZero(month)}${prependZero(day)}${prependZero(hours)}${prependZero(minutes)}`;
const insiderPackageJson = Object.assign(packageJson, {
version: `${major}.${minor}.${patch}`,
version: `${major}.${minor}.${patch}-${prerelease}`,
});
fse.writeFileSync("./package.json", JSON.stringify(insiderPackageJson, null, "\t"));
done();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Bazel support for Java Linting, Intellisense, formatting, refactoring and more...",
"author": "Salesforce Engineering",
"license": "BSD-3-Clause",
"version": "1.0.1",
"version": "1.1.0",
"publisher": "sfdc",
"bugs": "https://github.com/salesforce/bazel-vscode-java/issues",
"preview": true,
Expand Down

0 comments on commit 07bbcf7

Please sign in to comment.