From 5142b17e72858bc5a3225796665684b00f594701 Mon Sep 17 00:00:00 2001 From: Riri Date: Mon, 5 Feb 2024 11:07:59 +0800 Subject: [PATCH] feat: filter out deprecated versions --- src/api/version.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/version.ts b/src/api/version.ts index b85b238..e450fa0 100644 --- a/src/api/version.ts +++ b/src/api/version.ts @@ -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 {