docs: add starlight (#1859)

Co-authored-by: uncenter <[email protected]>
Co-authored-by: Hammy <[email protected]>
Co-authored-by: WalkQuackBack <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-08-31 19:02:22 -04:00
1 parent d5e22ed281
commit 84c0edf1ce
46 files changed
+5967 -522

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import YAML from "yaml";
import { type PortEntry, ports } from "./ports.ts";
export type Category = {
key: string;
name: string;
description: string;
emoji: string;
};
const CATEGORIES_URL =
"https://raw.githubusercontent.com/catppuccin/catppuccin/d4f82739e687cfd19d168be355367fdbbcc8e029/resources/categories.yml";
const content = await fetch(
CATEGORIES_URL,
).then((res) => res.text());
const parsed = YAML.parse(content) as Category[];
// Turn into a lookup table by key
export const categories = Object.fromEntries(parsed.map((c) => [c.key, c]));
// Group ports by category
export const categoryMap: Record<string, typeof ports> = ports.reduce(
(acc, port) => {
for (const cat of port.categories) {
if (!acc[cat]) acc[cat] = [];
acc[cat].push(port);
}
return acc;
},
{} as Record<string, PortEntry[]>,
);
// Sort categories by name
export const sortedCategories = Object.keys(categoryMap).sort((a, b) => {
const aName = categories[a]?.name ?? a;
const bName = categories[b]?.name ?? b;
return aName.localeCompare(bName);
});
+51
View File
@@ -0,0 +1,51 @@
// deno-lint-ignore-file no-explicit-any
import fs from "fs";
import path from "path";
import YAML from "yaml";
export type Collaborator = string;
export type PortEntry = {
slug: string;
name: string;
link: string;
categories: string[];
icon?: string;
color: string;
note?: string;
currentMaintainers?: Collaborator[];
pastMaintainers?: Collaborator[];
supports?: Record<string, { name: string; link: string }>;
};
const file = fs.readFileSync(
path.resolve("../scripts/userstyles.yml"),
"utf-8",
);
const parsed = YAML.parse(file) as {
collaborators: Collaborator[];
userstyles: Record<string, any>;
};
// TODO: Use proper types from scripts lib once possible.
// Normalize keys (camelCase)
function normalizePort(slug: string, data: any): PortEntry {
return {
slug,
name: data.name,
link: data.link,
categories: data.categories ?? [],
icon: data.icon,
color: data.color,
note: data.note,
currentMaintainers: data["current-maintainers"] ?? [],
pastMaintainers: data["past-maintainers"] ?? [],
supports: data.supports,
};
}
export const ports: PortEntry[] = Object.entries(parsed.userstyles).map(
([slug, data]) => normalizePort(slug, data),
);