Adding support for readme field in meta.json to registry
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-10-19 21:10:53 +02:00
parent d1244ac0a7
commit c9bd5c7d18
3 changed files with 12 additions and 8 deletions

View File

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

View File

@ -113,6 +113,7 @@ async function uploadPackage(ctx: ABC.Context) {
owner: ctx.customContext.user,
description: meta.description,
deprecated: false,
readme: meta.readme,
versions: [],
};

View File

@ -45,14 +45,16 @@ export default async function index({
);
version = getAbsolutePackageVersion(pkg, version);
const readmeContent = await getFile(pkg.name, version, "README.md").then(
(res) => {
const readmeContent = await getFile(
pkg.name,
version,
pkg.readme || "README.md"
).then((res) => {
if (res)
return Marked.parse(new TextDecoder().decode(res.data))
.content as string;
else return undefined;
}
);
});
return (
<Base title={"DenReg - " + pkg.name}>