Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(scripts/website): fix script to correctly parse "-rc" like versions #14004

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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