Skip to content

Commit

Permalink
chore(scripts/website): fix script to correctly parse "-rc" like vers…
Browse files Browse the repository at this point in the history
…ions

also some extra fixes
  • Loading branch information
hasezoey committed Oct 25, 2023
1 parent c28cffe commit 68166bf
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 68166bf

Please sign in to comment.