Skip to content

Commit

Permalink
feat: filter out deprecated versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Daydreamer-riri committed Feb 5, 2024
1 parent a1e1f52 commit 5142b17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function Header(name: string) {
export async function version(name: string, cwd: string) {
const registry = await getNpmRegistry(name, cwd)
try {
const data = await fetch.json(name, { registry, fullMetadata: true, headers: Header(name) })
const versions = Object.keys(data.versions || {}).filter(v => !v.includes('-'))
const data = await fetch.json(name, { registry, fullMetadata: true, headers: Header(name) }) as { versions: { [version: string]: { deprecated: string } } }
const versions = Object.keys(data.versions || {}).filter(v => (!v.includes('-') && !data.versions[v].deprecated))
return versions
}
catch {
Expand Down

0 comments on commit 5142b17

Please sign in to comment.