docs: add changelogs system

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-06-22 15:26:41 +02:00
parent e1b67b977c
commit 278d8ac5de
7 changed files with 102 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import { defineConfig } from "astro/config"
import starlight from "@astrojs/starlight"
import markdownIntegration from "@astropub/md"
// https://astro.build/config
export default defineConfig({
@ -33,5 +34,6 @@ export default defineConfig({
],
customCss: ["./src/styles/custom.css"],
}),
markdownIntegration(),
],
})

View File

@ -10,10 +10,11 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/starlight": "^0.24.0",
"@astropub/md": "^0.4.0",
"astro": "^4.8.6",
"sharp": "^0.32.5",
"@astrojs/check": "^0.7.0",
"typescript": "^5.4.5"
},
"packageManager": "pnpm@9.1.1+sha256.9551e803dcb7a1839fdf5416153a844060c7bce013218ce823410532504ac10b"

View File

@ -14,6 +14,9 @@ importers:
'@astrojs/starlight':
specifier: ^0.24.0
version: 0.24.0(astro@4.10.1(typescript@5.4.5))
'@astropub/md':
specifier: ^0.4.0
version: 0.4.0(@astrojs/markdown-remark@5.1.0)
astro:
specifier: ^4.8.6
version: 4.10.1(typescript@5.4.5)
@ -79,6 +82,11 @@ packages:
resolution: {integrity: sha512-/ca/+D8MIKEC8/A9cSaPUqQNZm+Es/ZinRv0ZAzvu2ios7POQSsVD+VOj7/hypWNsNM3T7RpfgNq7H2TU1KEHA==}
engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0}
'@astropub/md@0.4.0':
resolution: {integrity: sha512-f0kJIfywRKLcVqlizqUPModBBuJ7WwBEIWJEt1Eq/ksSYixtOl8HQWMZKJhv9Xtc9OKHhkQf0AQc56EV1xNUnw==}
peerDependencies:
'@astrojs/markdown-remark': ^4
'@babel/code-frame@7.24.7':
resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==}
engines: {node: '>=6.9.0'}
@ -2670,6 +2678,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@astropub/md@0.4.0(@astrojs/markdown-remark@5.1.0)':
dependencies:
'@astrojs/markdown-remark': 5.1.0
'@babel/code-frame@7.24.7':
dependencies:
'@babel/highlight': 7.24.7

View File

@ -0,0 +1,19 @@
---
version:
code: 1001001
name: 1.1.1-beta+gp20
title: Post-Beta Patch
date:
publish: 2024-06-22T12:57:44.148Z
summary: Customise your corners and look at the new tabs.
---
## Exciting new Features ✨
- **📷 Avatar Corner Radius** You can now customise the corner radius of user avatars. Whether in chat, profiles or anywhere else, give your avatars the perfect look.
- **🎨 Tabs Makeover** bs now look more modern, even when Material You is disabled. Major glow-up!
## Tweaks and Fixes 🔧
- **🧹 Dependency Updates** Freshened up dependencies to keep things neat.
- **🛑 On Timeout** Temporarily removed multimedia-related frameworks to save on app size. Don't worry, they're just on a short vacation.

View File

@ -1,6 +1,19 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
import { defineCollection, z } from "astro:content"
import { docsSchema } from "@astrojs/starlight/schema"
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};
docs: defineCollection({ schema: docsSchema() }),
changelogs: defineCollection({
schema: z.object({
version: z.object({
code: z.number(),
name: z.string(),
title: z.string(),
}),
date: z.object({
publish: z.date(),
}),
summary: z.string(),
}),
}),
}

View File

@ -0,0 +1,27 @@
import type { APIRoute } from "astro"
import { getCollection } from "astro:content"
export const GET: APIRoute = async () => {
const changelogs = await getCollection("changelogs")
return new Response(
JSON.stringify({
changelogs: changelogs.map((changelog) => ({
...changelog.data,
})),
}),
{
headers: {
"content-type": "application/json; charset=utf-8",
},
}
)
}
export const getStaticPaths = async () => {
const changelogs = await getCollection("changelogs")
return changelogs.map((changelog) => ({
params: {
versioncode: changelog.data.version.code.toString(),
},
}))
}

View File

@ -0,0 +1,23 @@
import { markdown } from "@astropub/md"
import type { APIRoute } from "astro"
import { getCollection, getEntry } from "astro:content"
export const GET: APIRoute = async ({ params }) => {
const { versioncode } = params
const changelog = await getEntry("changelogs", versioncode!)
const rendered = await markdown(changelog?.body!)
return new Response(JSON.stringify({ ...changelog, rendered }), {
headers: {
"content-type": "application/json; charset=utf-8",
},
})
}
export const getStaticPaths = async () => {
const changelogs = await getCollection("changelogs")
return changelogs.map((changelog) => ({
params: {
versioncode: changelog.data.version.code.toString(),
},
}))
}