fix(ci): proper types

This commit is contained in:
Barrett Ruth 2025-11-09 14:53:56 -05:00
parent 28c3cfcf6d
commit 16850cf468
9 changed files with 607 additions and 15 deletions

View file

@ -10,7 +10,7 @@ import BaseLayout from "../layouts/BaseLayout.astro";
<script>
document.addEventListener("DOMContentLoaded", function () {
const base = (window && window.TERMINAL_PROMPT) || "barrett@ruth:~$ ";
const base = "barrett@ruth:~$ ";
const el = document.querySelector(".terminal-prompt");
if (!el) return;
@ -26,11 +26,7 @@ import BaseLayout from "../layouts/BaseLayout.astro";
})();
};
if (window && typeof window.clearPrompt === "function") {
window.clearPrompt(250, type);
} else {
type();
}
type();
});
</script>

View file

@ -1,14 +1,19 @@
---
import { getCollection } from "astro:content";
import { getCollection, type CollectionEntry } from "astro:content";
import PostLayout from "../../layouts/PostLayout.astro";
import * as collections from "../../content/config";
import type { PostCollection, AnyCollectionEntry } from "../../types";
export async function getStaticPaths() {
const categories = Object.keys(collections.collections).filter(
(c) => c !== "git" && c !== "gists",
);
) as PostCollection[];
const entries: Array<{
params: { category: string; slug: string };
props: { post: AnyCollectionEntry };
}> = [];
const entries = [];
for (const category of categories) {
const docs = await getCollection(category);
for (const doc of docs) {
@ -21,6 +26,10 @@ export async function getStaticPaths() {
return entries;
}
interface Props {
post: AnyCollectionEntry;
}
const { post } = Astro.props;
const category = Astro.params.category;
const { Content } = await post.render();

View file

@ -3,6 +3,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro";
import { getCollection } from "astro:content";
import { sortItem } from "../../utils/sort.js";
import * as collections from "../../content/config";
import type { PostCollection } from "../../types";
export async function getStaticPaths() {
return Object.keys(collections.collections)
@ -12,7 +13,7 @@ export async function getStaticPaths() {
}));
}
const category = Astro.params.category;
const category = Astro.params.category as PostCollection;
const title = "Barrett Ruth";
const posts = await getCollection(category);

View file

@ -1,12 +1,27 @@
---
import BaseLayout from "../layouts/BaseLayout.astro";
import { sortItem } from "../utils/sort.js";
import { getCollection } from "astro:content";
import { getCollection, type CollectionEntry } from "astro:content";
import type { PostCollection } from "../types";
const title = "Barrett Ruth";
const CATS = ["algorithms", "software", "meditations", "autonomous-racing"];
const CATS: PostCollection[] = [
"algorithms",
"software",
"meditations",
"autonomous-racing",
];
const postsByCategory = {};
type PostData = {
id: string;
slug: string;
data: {
title: string;
date: string | null;
};
};
const postsByCategory: Record<string, PostData[]> = {};
for (const c of CATS) {
const entries = await getCollection(c);
entries.sort(sortItem);