From 278d8ac5ded1ba8a6cb1c66babbe51f9077afb59 Mon Sep 17 00:00:00 2001 From: Infi Date: Sat, 22 Jun 2024 15:26:41 +0200 Subject: [PATCH] docs: add changelogs system Signed-off-by: Infi --- docs/astro.config.mjs | 2 ++ docs/package.json | 3 ++- docs/pnpm-lock.yaml | 12 +++++++++ docs/src/content/changelogs/1001001.md | 19 +++++++++++++ docs/src/content/config.ts | 21 ++++++++++++--- docs/src/pages/changelogs.json.ts | 27 +++++++++++++++++++ .../pages/changelogs/[versioncode].json.ts | 23 ++++++++++++++++ 7 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 docs/src/content/changelogs/1001001.md create mode 100644 docs/src/pages/changelogs.json.ts create mode 100644 docs/src/pages/changelogs/[versioncode].json.ts diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 1f70cc7a..1d61c6a7 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -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(), ], }) diff --git a/docs/package.json b/docs/package.json index dcf7ed17..5390cbfb 100644 --- a/docs/package.json +++ b/docs/package.json @@ -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" diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 3accc50c..aef009d8 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -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 diff --git a/docs/src/content/changelogs/1001001.md b/docs/src/content/changelogs/1001001.md new file mode 100644 index 00000000..2d4a0e08 --- /dev/null +++ b/docs/src/content/changelogs/1001001.md @@ -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. diff --git a/docs/src/content/config.ts b/docs/src/content/config.ts index 45f60b01..5a4e4092 100644 --- a/docs/src/content/config.ts +++ b/docs/src/content/config.ts @@ -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(), + }), + }), +} diff --git a/docs/src/pages/changelogs.json.ts b/docs/src/pages/changelogs.json.ts new file mode 100644 index 00000000..5a19a324 --- /dev/null +++ b/docs/src/pages/changelogs.json.ts @@ -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(), + }, + })) +} diff --git a/docs/src/pages/changelogs/[versioncode].json.ts b/docs/src/pages/changelogs/[versioncode].json.ts new file mode 100644 index 00000000..1290ff04 --- /dev/null +++ b/docs/src/pages/changelogs/[versioncode].json.ts @@ -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(), + }, + })) +}