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; author: string;
description: string; description: string;
versions: string[]; versions: string[];
deprecated: boolean;
} }
export interface IApiKey { export interface IApiKey {

View File

@ -103,6 +103,7 @@ async function uploadPackage(ctx: ABC.Context) {
name: packageName, name: packageName,
author: meta.author, author: meta.author,
description: meta.description, description: meta.description,
deprecated: false,
versions: [], versions: [],
}; };
@ -149,6 +150,7 @@ async function uploadPackage(ctx: ABC.Context) {
versions: [...packageMeta.versions, packageVersion], versions: [...packageMeta.versions, packageVersion],
author: meta.author || packageMeta.author, author: meta.author || packageMeta.author,
description: meta.description || packageMeta.description, 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"; import { sortVersions } from "../utils.ts";
function Package({ pkg }: { pkg: IPackage }) { function Package({ pkg }: { pkg: IPackage }) {
const { name, versions, author, description } = pkg; const { name, versions, author, description, deprecated } = pkg;
const sorted = versions.sort(sortVersions).reverse(); const sorted = versions.sort(sortVersions).reverse();
@ -17,6 +17,7 @@ function Package({ pkg }: { pkg: IPackage }) {
<div class="card-body"> <div class="card-body">
<h4 class="card-title"> <h4 class="card-title">
{name} <span class="badge">{sorted[0]}</span> {name} <span class="badge">{sorted[0]}</span>
{deprecated && <span class="badge warning">deprecated</span>}
</h4> </h4>
<h5 class="card-subtitle">By {author}</h5> <h5 class="card-subtitle">By {author}</h5>
<div class="card-text"> <div class="card-text">