Skip to content

Commit f3dafd1

Browse files
committed
add changelog page
1 parent e7c807a commit f3dafd1

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

src/components/navigation/sidebars/nav/RootNav.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ if (versionName) {
9090
link="/about"
9191
current={currentPath.length === 1 && currentPath[0] === "about"}
9292
/>
93+
<Link
94+
title="Changelog"
95+
link="/changelog"
96+
current={currentPath.length === 1 && currentPath[0] === "changelog"}
97+
/>
9398
{ versionedEntries && <Tree {...versionsTree as TreeEntry}/>}
9499
<hr/>
95100
{ versionedEntries && (

src/config/io/generateTypeData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ async function readVersionsData(): Promise<VersionsData> {
4747
const content = await fs.readFile(versionsPath, "utf8");
4848
const data = JSON.parse(content);
4949

50-
const versions = await Promise.all(data.versions.map(async (d: { name: string, types: any }) => ({
50+
const versions = await Promise.all(data.versions.map(async (d: { name: string, changelog?: string, types: any }) => ({
5151
name: d.name,
52+
changelog: d.changelog ? await fs.readFile(d.changelog, "utf8") : undefined,
5253
modules: await readModulesData(d.types),
5354
})));
5455

src/config/io/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export interface ModuleData {
8484

8585
export interface VersionData {
8686
name: string;
87+
changelog?: string;
8788
modules: ModuleData[];
8889
}
8990

src/pages/changelog.astro

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
import GuideLayout from "@layouts/GuideLayout.astro";
3+
import { getVersionsData } from "@config/io/generateTypeData";
4+
import { processMarkdown } from "@config/io/markdown";
5+
6+
const { versions } = await getVersionsData();
7+
8+
const versionsMd = await Promise.all(versions.filter(version => version.changelog).map(async version => ({
9+
version,
10+
changelog: await processMarkdown(version.name, version.changelog!)
11+
})));
12+
13+
const headings = versionsMd.map(({ version }) => ({
14+
text: version.name,
15+
slug: version.name,
16+
depth: 1,
17+
}));
18+
---
19+
<GuideLayout title="Changelog" description="" headings={headings}>
20+
{versionsMd.map(({ version, changelog }) => (
21+
<div style="display: flex; justify-content: space-between">
22+
<h2 id={version.name}>{version.name}</h2>
23+
<h2><a href={`/docs/${version.name}/guide`}>Documentation</a></h2>
24+
</div>
25+
<hr/>
26+
<Fragment set:html={changelog}/>
27+
))}
28+
</GuideLayout>

src/pages/changelog.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)