Skip to content

Commit

Permalink
Merge pull request #14004 from hasezoey/fixwebsite
Browse files Browse the repository at this point in the history
chore(scripts/website): fix script to correctly parse "-rc" like versions
  • Loading branch information
vkarpov15 authored Oct 25, 2023
2 parents c28cffe + 68166bf commit db92dd9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ let filteredTags = [];
* @returns number array or undefined
*/
function parseVersion(str) {
const versionReg = /^v?(\d+)\.(\d+)\.(\d+)$/i;
// there is no ending "$", because of "rc"-like versions
const versionReg = /^v?(\d+)\.(\d+)\.(\d+)/i;

const match = versionReg.exec(str);

Expand All @@ -105,12 +106,23 @@ function parseVersion(str) {
return parsed;
}

// special case, to not log a warning
if (str === "test") {
return undefined;
}

console.log(`Failed to parse version! got: ${str}`);

return undefined;
}

/**
* Get versions from git tags and put them into {@link filteredTags}
*/
function getVersions() {
// get all tags from git
const res = childProcess.execSync("git tag").toString();
// "trim" is used to remove the ending new-line
const res = childProcess.execSync("git tag").toString().trim();

filteredTags = res.split('\n')
// map all gotten tags if they match the regular expression
Expand Down

0 comments on commit db92dd9

Please sign in to comment.