chore(sfc-playground): improve version dropdown
This commit is contained in:
parent
40994e967c
commit
f173cf0026
@ -47,8 +47,24 @@ async function fetchVersions(): Promise<string[]> {
|
|||||||
const versions = releases.map(r =>
|
const versions = releases.map(r =>
|
||||||
/^v/.test(r.tag_name) ? r.tag_name.substr(1) : r.tag_name
|
/^v/.test(r.tag_name) ? r.tag_name.substr(1) : r.tag_name
|
||||||
)
|
)
|
||||||
const minVersion = versions.findIndex(v => v === '3.0.10')
|
// if the latest version is a pre-release, list all current pre-releases
|
||||||
return versions.slice(0, minVersion + 1)
|
// otherwise filter out pre-releases
|
||||||
|
let isInPreRelease = versions[0].includes('-')
|
||||||
|
const filteredVersions: string[] = []
|
||||||
|
for (const v of versions) {
|
||||||
|
if (v.includes('-')) {
|
||||||
|
if (isInPreRelease) {
|
||||||
|
filteredVersions.push(v)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filteredVersions.push(v)
|
||||||
|
isInPreRelease = false
|
||||||
|
}
|
||||||
|
if (filteredVersions.length >= 30 || v === '3.0.10') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filteredVersions
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user