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

View File

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

View File

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