From 68166bf17c05d6652232bf0f2b3ecaddb3779279 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Wed, 25 Oct 2023 10:26:21 +0200 Subject: [PATCH] chore(scripts/website): fix script to correctly parse "-rc" like versions also some extra fixes --- scripts/website.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/website.js b/scripts/website.js index b1ea3eb0c56..5d9d884b87b 100644 --- a/scripts/website.js +++ b/scripts/website.js @@ -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); @@ -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