Skip to content

Commit db92dd9

Browse files
authored
Merge pull request #14004 from hasezoey/fixwebsite
chore(scripts/website): fix script to correctly parse "-rc" like versions
2 parents c28cffe + 68166bf commit db92dd9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/website.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ let filteredTags = [];
9090
* @returns number array or undefined
9191
*/
9292
function parseVersion(str) {
93-
const versionReg = /^v?(\d+)\.(\d+)\.(\d+)$/i;
93+
// there is no ending "$", because of "rc"-like versions
94+
const versionReg = /^v?(\d+)\.(\d+)\.(\d+)/i;
9495

9596
const match = versionReg.exec(str);
9697

@@ -105,12 +106,23 @@ function parseVersion(str) {
105106
return parsed;
106107
}
107108

109+
// special case, to not log a warning
110+
if (str === "test") {
111+
return undefined;
112+
}
113+
114+
console.log(`Failed to parse version! got: ${str}`);
115+
108116
return undefined;
109117
}
110118

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

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

0 commit comments

Comments
 (0)