fix: exclude yml into totaldownload start next version (#4572)

This commit is contained in:
Faisal Amir 2025-02-04 20:59:27 +07:00 committed by GitHub
parent ddc2cd5e0f
commit 678116c6d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1623 additions and 1789 deletions

View File

@ -6,15 +6,20 @@ export function formatCompactNumber(count: number) {
export const totalDownload = (release: []) => { export const totalDownload = (release: []) => {
if (release instanceof Array) { if (release instanceof Array) {
const count = release const count = release
.map((version: { assets: any[] }) => .map((version: { assets: any[]; name: string }) => {
version.assets.map((os) => os.download_count) // it will be correct since 0.5.15
) const tag = version.name >= '0.5.15' && version.name.includes('0.5.15')
return version.assets
.filter((os) => !(tag && os.name.endsWith('.yml')))
.map((os) => os.download_count)
})
.map((x: any[]) => x.reduce((a: any, b: any) => a + b, 0)) .map((x: any[]) => x.reduce((a: any, b: any) => a + b, 0))
.reduce((a: any, b: any) => a + b, 0) .reduce((a: any, b: any) => a + b, 0)
return formatCompactNumber(count) return formatCompactNumber(count)
} else { } else {
// return dummy avoid reate limit API when dev mode // return dummy to avoid rate limit API when in dev mode
return formatCompactNumber(9000000) return formatCompactNumber(9000000)
} }
} }

File diff suppressed because it is too large Load Diff