chore: migrate to Astro 5 stuff

This commit is contained in:
Ayo Ayco 2025-01-10 12:05:13 +01:00
parent 792b592fca
commit 113248b6ed
6 changed files with 503 additions and 947 deletions

View file

@ -1,6 +1,5 @@
import { defineConfig } from 'astro/config'
import node from '@astrojs/node'
import mdx from '@astrojs/mdx'
import sitemap from '@astrojs/sitemap'
import serviceWorker from '@ayco/astro-sw'
@ -8,13 +7,12 @@ import { VERSION } from './src/consts'
// https://astro.build/config
export default defineConfig({
output: 'hybrid',
output: 'static',
site: 'https://cozy.pub/',
adapter: node({
mode: 'middleware',
}),
integrations: [
mdx(),
sitemap(),
serviceWorker({
path: './src/sw.mjs',

View file

@ -24,9 +24,8 @@
},
"devDependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^4.0.3",
"@astrojs/node": "^9.0.0",
"@astrojs/rss": "^4.0.10",
"@astrojs/rss": "^4.0.11",
"@astrojs/sitemap": "^3.2.1",
"@ayco/astro-sw": "^0.8.14",
"@eslint/compat": "^1.2.4",
@ -34,7 +33,7 @@
"@extractus/article-extractor": "^8.0.16",
"@fastify/middie": "^9.0.2",
"@fastify/static": "^8.0.3",
"astro": "^5.1.1",
"astro": "^5.1.5",
"astro-eslint-parser": "^1.1.0",
"astro-iconify": "^1.2.0",
"eslint": "^9.17.0",
@ -42,15 +41,15 @@
"eslint-plugin-astro": "^1.3.1",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.1",
"fastify": "^5.2.0",
"fastify": "^5.2.1",
"globals": "^15.14.0",
"husky": "^9.1.7",
"lint-staged": "^15.3.0",
"prettier": "^3.4.2",
"prettier-plugin-astro": "^0.14.1",
"sass": "^1.83.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.2",
"sass": "^1.83.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.19.1",
"ultrahtml": "^1.5.3",
"vitest": "^2.1.8"
},

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ import { VERSION } from '../consts'
/> by <a href="https://ayo.ayco.io">Ayo Ayco</a>
<br />
<a href="/blog">Blog</a> •
<a href="https://github.com/ayoayco/cozy">GitHub</a> •
<a href="https://ayco.io/sh/cozy">SourceHut</a> •
<a href="https://social.ayco.io/@ayo">Mastodon</a>
<br />
<span>{VERSION}</span>

View file

@ -1,7 +1,8 @@
import { glob } from 'astro/loaders'
import { defineCollection, z } from 'astro:content'
const blog = defineCollection({
type: 'content',
loader: glob({ base: './src/content/blog', pattern: '**/*.md' }),
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),

View file

@ -1,5 +1,5 @@
---
import { type CollectionEntry, getCollection } from 'astro:content'
import { type CollectionEntry, getCollection, render } from 'astro:content'
import Blog from '../../layouts/Blog.astro'
export async function getStaticPaths() {
@ -12,7 +12,7 @@ export async function getStaticPaths() {
type Props = CollectionEntry<'blog'>
const post = Astro.props
const { Content } = await post.render()
const { Content } = await render(post)
---
<Blog {...post.data}>