add changelog page
This commit is contained in:
parent
e7c807ac85
commit
f3dafd1172
5 changed files with 36 additions and 9 deletions
|
@ -90,6 +90,11 @@ if (versionName) {
|
|||
link="/about"
|
||||
current={currentPath.length === 1 && currentPath[0] === "about"}
|
||||
/>
|
||||
<Link
|
||||
title="Changelog"
|
||||
link="/changelog"
|
||||
current={currentPath.length === 1 && currentPath[0] === "changelog"}
|
||||
/>
|
||||
{ versionedEntries && <Tree {...versionsTree as TreeEntry}/>}
|
||||
<hr/>
|
||||
{ versionedEntries && (
|
||||
|
|
|
@ -47,8 +47,9 @@ async function readVersionsData(): Promise<VersionsData> {
|
|||
const content = await fs.readFile(versionsPath, "utf8");
|
||||
const data = JSON.parse(content);
|
||||
|
||||
const versions = await Promise.all(data.versions.map(async (d: { name: string, types: any }) => ({
|
||||
const versions = await Promise.all(data.versions.map(async (d: { name: string, changelog?: string, types: any }) => ({
|
||||
name: d.name,
|
||||
changelog: d.changelog ? await fs.readFile(d.changelog, "utf8") : undefined,
|
||||
modules: await readModulesData(d.types),
|
||||
})));
|
||||
|
||||
|
|
1
src/config/io/types.d.ts
vendored
1
src/config/io/types.d.ts
vendored
|
@ -84,6 +84,7 @@ export interface ModuleData {
|
|||
|
||||
export interface VersionData {
|
||||
name: string;
|
||||
changelog?: string;
|
||||
modules: ModuleData[];
|
||||
}
|
||||
|
||||
|
|
28
src/pages/changelog.astro
Normal file
28
src/pages/changelog.astro
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
import GuideLayout from "@layouts/GuideLayout.astro";
|
||||
import { getVersionsData } from "@config/io/generateTypeData";
|
||||
import { processMarkdown } from "@config/io/markdown";
|
||||
|
||||
const { versions } = await getVersionsData();
|
||||
|
||||
const versionsMd = await Promise.all(versions.filter(version => version.changelog).map(async version => ({
|
||||
version,
|
||||
changelog: await processMarkdown(version.name, version.changelog!)
|
||||
})));
|
||||
|
||||
const headings = versionsMd.map(({ version }) => ({
|
||||
text: version.name,
|
||||
slug: version.name,
|
||||
depth: 1,
|
||||
}));
|
||||
---
|
||||
<GuideLayout title="Changelog" description="" headings={headings}>
|
||||
{versionsMd.map(({ version, changelog }) => (
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<h2 id={version.name}>{version.name}</h2>
|
||||
<h2><a href={`/docs/${version.name}/guide`}>Documentation</a></h2>
|
||||
</div>
|
||||
<hr/>
|
||||
<Fragment set:html={changelog}/>
|
||||
))}
|
||||
</GuideLayout>
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
layout: "@layouts/GuideMdLayout.astro"
|
||||
title: Changelog
|
||||
---
|
||||
|
||||
## v0.2.0
|
||||
|
||||
## v0.1.0
|
Loading…
Add table
Add a link
Reference in a new issue