Skip to content

Commit

Permalink
chore(sfc-playground): improve version dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 23, 2021
1 parent 40994e9 commit f173cf0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/sfc-playground/src/Header.vue
Expand Up @@ -47,8 +47,24 @@ async function fetchVersions(): Promise<string[]> {
const versions = releases.map(r =>
/^v/.test(r.tag_name) ? r.tag_name.substr(1) : r.tag_name
)
const minVersion = versions.findIndex(v => v === '3.0.10')
return versions.slice(0, minVersion + 1)
// if the latest version is a pre-release, list all current pre-releases
// 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>

Expand Down

0 comments on commit f173cf0

Please sign in to comment.