From 5337b44b11e89dcc4875b6a8a2b972bfe02c4e25 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sat, 1 Aug 2020 00:15:10 +0200 Subject: [PATCH] Add package deprecation --- registry/src/db.ts | 1 + registry/src/http/api.ts | 2 ++ registry/src/views/index.tsx | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/registry/src/db.ts b/registry/src/db.ts index c7b49b3..34a0b7b 100644 --- a/registry/src/db.ts +++ b/registry/src/db.ts @@ -7,6 +7,7 @@ export interface IPackage { author: string; description: string; versions: string[]; + deprecated: boolean; } export interface IApiKey { diff --git a/registry/src/http/api.ts b/registry/src/http/api.ts index 365eff8..275fb9b 100644 --- a/registry/src/http/api.ts +++ b/registry/src/http/api.ts @@ -103,6 +103,7 @@ async function uploadPackage(ctx: ABC.Context) { name: packageName, author: meta.author, description: meta.description, + deprecated: false, versions: [], }; @@ -149,6 +150,7 @@ async function uploadPackage(ctx: ABC.Context) { versions: [...packageMeta.versions, packageVersion], author: meta.author || packageMeta.author, description: meta.description || packageMeta.description, + deprecated: meta.deprecated === true, }, } ); diff --git a/registry/src/views/index.tsx b/registry/src/views/index.tsx index d368cb7..60c6d19 100644 --- a/registry/src/views/index.tsx +++ b/registry/src/views/index.tsx @@ -5,7 +5,7 @@ import DB, { IPackage } from "../db.ts"; import { sortVersions } from "../utils.ts"; function Package({ pkg }: { pkg: IPackage }) { - const { name, versions, author, description } = pkg; + const { name, versions, author, description, deprecated } = pkg; const sorted = versions.sort(sortVersions).reverse(); @@ -17,6 +17,7 @@ function Package({ pkg }: { pkg: IPackage }) {

{name} {sorted[0]} + {deprecated && deprecated}

By {author}