From 5647c04f1c20f9dfa88e8648bf37e986c76a2573 Mon Sep 17 00:00:00 2001 From: Christian van der Loo Date: Sun, 15 Mar 2026 15:47:06 -0400 Subject: [PATCH] use at-astro-loader --- bun.lock | 5 +++++ package.json | 3 +++ .../at-astro-loader.json | 7 +++++++ src/content.config.ts | 15 --------------- src/live.config.ts | 12 ++++++++++++ src/pages/index.astro | 4 ++-- tsconfig.json | 8 ++++---- 7 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 records/com.chrisvanderloo.project/at-astro-loader.json create mode 100644 src/live.config.ts diff --git a/bun.lock b/bun.lock index 373ba7c..99e1686 100644 --- a/bun.lock +++ b/bun.lock @@ -11,6 +11,7 @@ "@atproto/lex": "^0.0.20", "astro": "^6.0.3", "astro-icon": "^1.1.5", + "at-astro-loader": "^1.0.1", "dayjs": "^1.11.19", "markdown-it": "^14.1.1", "sanitize-html": "^2.17.1", @@ -18,6 +19,8 @@ "wrangler": "^4.72.0", }, "devDependencies": { + "@atproto/lex-client": "^0.0.15", + "@atproto/lex-schema": "^0.0.14", "@iconify-json/akar-icons": "^1.2.7", "@iconify-json/bi": "^1.2.7", "@tailwindcss/typography": "^0.5.19", @@ -425,6 +428,8 @@ "astro-icon": ["astro-icon@1.1.5", "", { "dependencies": { "@iconify/tools": "^4.0.5", "@iconify/types": "^2.0.0", "@iconify/utils": "^2.1.30" } }, "sha512-CJYS5nWOw9jz4RpGWmzNQY7D0y2ZZacH7atL2K9DeJXJVaz7/5WrxeyIxO8KASk1jCM96Q4LjRx/F3R+InjJrw=="], + "at-astro-loader": ["at-astro-loader@1.0.1", "", { "dependencies": { "@atproto/lex": "^0.0.20", "@atproto/lex-client": "^0.0.15", "zod": "^4.3.6" }, "peerDependencies": { "astro": "^5 || ^6" } }, "sha512-zze/+IHSXCa1aW0QJE/G5/qSuJCaxKtP5kpJG/SRi0n2AXbtf9wOp4jhJGND6lQn76Nd6kN3xetZ8cRatrmAFw=="], + "atomic-sleep": ["atomic-sleep@1.0.0", "", {}, "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="], "axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="], diff --git a/package.json b/package.json index 9d86d39..48cfa48 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@atproto/lex": "^0.0.20", "astro": "^6.0.3", "astro-icon": "^1.1.5", + "at-astro-loader": "^1.0.1", "dayjs": "^1.11.19", "markdown-it": "^14.1.1", "sanitize-html": "^2.17.1", @@ -27,6 +28,8 @@ "wrangler": "^4.72.0" }, "devDependencies": { + "@atproto/lex-client": "^0.0.15", + "@atproto/lex-schema": "^0.0.14", "@iconify-json/akar-icons": "^1.2.7", "@iconify-json/bi": "^1.2.7", "@tailwindcss/typography": "^0.5.19", diff --git a/records/com.chrisvanderloo.project/at-astro-loader.json b/records/com.chrisvanderloo.project/at-astro-loader.json new file mode 100644 index 0000000..9be79af --- /dev/null +++ b/records/com.chrisvanderloo.project/at-astro-loader.json @@ -0,0 +1,7 @@ +{ + "$type": "com.chrisvanderloo.project", + "title": "at-astro-loader", + "description": "An Astro loader for ATProto data.", + "repo": "https://github.com/chrisvander/at-astro-loader", + "language": "TypeScript" +} diff --git a/src/content.config.ts b/src/content.config.ts index 2fab01e..5e8b794 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -17,21 +17,6 @@ const blogCollection = defineCollection({ }), }); -const projectsCollection = defineCollection({ - loader: glob({ - base: "./src/content/projects", - pattern: "**/*.json", - }), - schema: z.object({ - title: z.string(), - description: z.string(), - link: z.string().optional(), - repo: z.string(), - language: z.string(), - }), -}); - export const collections = { blog: blogCollection, - projects: projectsCollection, }; diff --git a/src/live.config.ts b/src/live.config.ts new file mode 100644 index 0000000..5144239 --- /dev/null +++ b/src/live.config.ts @@ -0,0 +1,12 @@ +import { defineLiveCollection } from "astro:content"; +import * as com from "./lexicons/com"; +import { atLiveLoader } from "at-astro-loader"; + +const projects = defineLiveCollection({ + loader: atLiveLoader(com.chrisvanderloo.project, { + endpoint: "https://bsky.chrisvanderloo.com", + repo: "chrisvanderloo.com", + }), +}); + +export const collections = { projects }; diff --git a/src/pages/index.astro b/src/pages/index.astro index d563833..2985b65 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,5 +1,5 @@ --- -import { getCollection } from "astro:content"; +import { getCollection, getLiveCollection } from "astro:content"; import { Icon } from "astro-icon/components"; import dayjs from "dayjs"; import BaseLayout from "../layouts/BaseLayout.astro"; @@ -11,7 +11,7 @@ const postsSorted = posts return new Date(b.data.date).getTime() - new Date(a.data.date).getTime(); }); -const projects = await getCollection("projects"); +const { entries: projects = [] } = await getLiveCollection("projects"); --- diff --git a/tsconfig.json b/tsconfig.json index d4b8b37..ca6b179 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,11 +3,11 @@ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react", - "baseUrl": ".", + "exactOptionalPropertyTypes": false, "paths": { - "@images/*": ["public/images/*"] - } + "@images/*": ["./public/images/*"], + }, }, "include": [".astro/types.d.ts", "**/*", "./worker-configuration.d.ts"], - "exclude": ["dist", "src/lexicons"] + "exclude": ["dist"], } -- 2.51.2