Add package deprecation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-08-01 00:15:10 +02:00
parent 81213a9aba
commit 5337b44b11
3 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ export interface IPackage {
author: string;
description: string;
versions: string[];
deprecated: boolean;
}
export interface IApiKey {

View File

@ -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,
},
}
);

View File

@ -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 }) {
<div class="card-body">
<h4 class="card-title">
{name} <span class="badge">{sorted[0]}</span>
{deprecated && <span class="badge warning">deprecated</span>}
</h4>
<h5 class="card-subtitle">By {author}</h5>
<div class="card-text">