chore(astro): upgrade to astro 6 with legacy content compatibility
All checks were successful
SMOKE / smoke (push) Successful in 11s
CI / build-and-anchors (push) Successful in 40s
CI / build-and-anchors (pull_request) Successful in 38s

This commit is contained in:
2026-03-11 17:17:02 +01:00
parent 20aecc30b1
commit 683b02f4a0
9 changed files with 458 additions and 1183 deletions

View File

@@ -86,6 +86,10 @@ function rehypeDedupeIds() {
} }
export default defineConfig({ export default defineConfig({
legacy: {
collectionsBackwardsCompat: true,
},
output: "static", output: "static",
trailingSlash: "always", trailingSlash: "always",
site: process.env.PUBLIC_SITE ?? "http://localhost:4321", site: process.env.PUBLIC_SITE ?? "http://localhost:4321",

1565
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,11 +25,11 @@
"ci": "CI=1 npm test" "ci": "CI=1 npm test"
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.3.13", "@astrojs/mdx": "^5.0.0",
"astro": "^5.18.0" "astro": "^6.0.2"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/sitemap": "^3.7.0", "@astrojs/sitemap": "^3.7.1",
"mammoth": "^1.11.0", "mammoth": "^1.11.0",
"pagefind": "^1.4.0", "pagefind": "^1.4.0",
"rehype-autolink-headings": "^7.1.0", "rehype-autolink-headings": "^7.1.0",

View File

@@ -1,34 +1,38 @@
--- ---
import EditionLayout from "../../layouts/EditionLayout.astro"; import EditionLayout from "../../layouts/EditionLayout.astro";
import { getCollection } from "astro:content";
import EditionToc from "../../components/EditionToc.astro"; import EditionToc from "../../components/EditionToc.astro";
import LocalToc from "../../components/LocalToc.astro"; import LocalToc from "../../components/LocalToc.astro";
import { getCollection, render } from "astro:content";
export async function getStaticPaths() { export async function getStaticPaths() {
// ✅ Après migration : plus de filtre par prefix, on prend toute la collection
const entries = await getCollection("archicrat-ia"); const entries = await getCollection("archicrat-ia");
return entries.map((entry) => ({ return entries.map((entry) => ({
params: { slug: entry.slug }, params: { slug: String(entry.id).replace(/\.(md|mdx)$/i, "") },
props: { entry }, props: { entry }
})); }));
} }
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content, headings } = await entry.render(); const { Content, headings } = await render(entry);
--- ---
<EditionLayout <EditionLayout
title={entry.data.title} title={entry.data.title}
editionLabel="Essai-thèse" editionLabel="Essai-thèse"
editionKey="archicrat-ia" editionKey="archicrat-ia"
statusLabel="essai-thèse" statusLabel="Essai-thèse"
statusKey="essai_these" statusKey="essai_these"
level={entry.data.level} level={entry.data.level ?? 1}
version={entry.data.version} version={entry.data.version}
> >
<Fragment slot="aside"> <Fragment slot="aside">
<EditionToc currentSlug={entry.slug} /> <EditionToc
currentSlug={String(entry.id).replace(/\.(md|mdx)$/i, "")}
collection="archicrat-ia"
basePath="/archicrat-ia"
label="Table des matières — ArchiCraT-IA"
/>
<LocalToc headings={headings} /> <LocalToc headings={headings} />
</Fragment> </Fragment>

View File

@@ -2,12 +2,8 @@
import SiteLayout from "../../layouts/SiteLayout.astro"; import SiteLayout from "../../layouts/SiteLayout.astro";
import { getCollection } from "astro:content"; import { getCollection } from "astro:content";
// ✅ Après migration physique : collection = "archicrat-ia", slug = "chapitre-3" (sans prefix)
const entries = await getCollection("archicrat-ia"); const entries = await getCollection("archicrat-ia");
entries.sort((a, b) => (a.data.order ?? 9999) - (b.data.order ?? 9999)); entries.sort((a, b) => (a.data.order ?? 9999) - (b.data.order ?? 9999));
const href = (slug) => `/archicrat-ia/${slug}/`;
--- ---
<SiteLayout title="Essai-thèse — ArchiCraT-IA"> <SiteLayout title="Essai-thèse — ArchiCraT-IA">
@@ -15,7 +11,11 @@ const href = (slug) => `/archicrat-ia/${slug}/`;
<ul> <ul>
{entries.map((e) => ( {entries.map((e) => (
<li><a href={href(e.slug)}>{e.data.title}</a></li> <li>
<a href={`/archicrat-ia/${String(e.id).replace(/\.(md|mdx)$/i, "")}/`}>
{e.data.title}
</a>
</li>
))} ))}
</ul> </ul>
</SiteLayout> </SiteLayout>

View File

@@ -2,19 +2,19 @@
import EditionLayout from "../../layouts/EditionLayout.astro"; import EditionLayout from "../../layouts/EditionLayout.astro";
import EditionToc from "../../components/EditionToc.astro"; import EditionToc from "../../components/EditionToc.astro";
import LocalToc from "../../components/LocalToc.astro"; import LocalToc from "../../components/LocalToc.astro";
import { getCollection } from "astro:content"; import { getCollection, render } from "astro:content";
export async function getStaticPaths() { export async function getStaticPaths() {
const entries = await getCollection("cas-ia"); const entries = await getCollection("cas-ia");
return entries.map((entry) => ({ return entries.map((entry) => ({
params: { slug: entry.slug }, params: { slug: String(entry.id).replace(/\.(md|mdx)$/i, "") },
props: { entry } props: { entry }
})); }));
} }
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content, headings } = await entry.render(); const { Content, headings } = await render(entry);
--- ---
<EditionLayout <EditionLayout
@@ -28,7 +28,7 @@ const { Content, headings } = await entry.render();
> >
<Fragment slot="aside"> <Fragment slot="aside">
<EditionToc <EditionToc
currentSlug={entry.slug} currentSlug={String(entry.id).replace(/\.(md|mdx)$/i, "")}
collection="cas-ia" collection="cas-ia"
basePath="/cas-ia" basePath="/cas-ia"
label="Table des matières — Cas pratique IA" label="Table des matières — Cas pratique IA"
@@ -37,6 +37,5 @@ const { Content, headings } = await entry.render();
</Fragment> </Fragment>
<h1>{entry.data.title}</h1> <h1>{entry.data.title}</h1>
<Content /> <Content />
</EditionLayout> </EditionLayout>

View File

@@ -3,10 +3,7 @@ import SiteLayout from "../../layouts/SiteLayout.astro";
import { getCollection } from "astro:content"; import { getCollection } from "astro:content";
const entries = await getCollection("cas-ia"); const entries = await getCollection("cas-ia");
entries.sort((a, b) => (a.data.order ?? 9999) - (b.data.order ?? 9999)); entries.sort((a, b) => (a.data.order ?? 9999) - (b.data.order ?? 9999));
const href = (slug: string) => `/cas-ia/${slug}/`;
--- ---
<SiteLayout title="Cas pratique — Gouvernance des systèmes IA"> <SiteLayout title="Cas pratique — Gouvernance des systèmes IA">
@@ -14,7 +11,11 @@ const href = (slug: string) => `/cas-ia/${slug}/`;
<ul> <ul>
{entries.map((e) => ( {entries.map((e) => (
<li><a href={href(e.slug)}>{e.data.title}</a></li> <li>
<a href={`/cas-ia/${String(e.id).replace(/\.(md|mdx)$/i, "")}/`}>
{e.data.title}
</a>
</li>
))} ))}
</ul> </ul>
</SiteLayout> </SiteLayout>

View File

@@ -1,17 +1,17 @@
--- ---
import EditionLayout from "../../layouts/EditionLayout.astro"; import EditionLayout from "../../layouts/EditionLayout.astro";
import { getCollection } from "astro:content"; import { getCollection, render } from "astro:content";
export async function getStaticPaths() { export async function getStaticPaths() {
const entries = await getCollection("glossaire"); const entries = await getCollection("glossaire");
return entries.map((entry) => ({ return entries.map((entry) => ({
params: { slug: entry.slug }, params: { slug: String(entry.id).replace(/\.(md|mdx)$/i, "") },
props: { entry }, props: { entry },
})); }));
} }
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content } = await entry.render(); const { Content } = await render(entry);
--- ---
<EditionLayout <EditionLayout

View File

@@ -5,11 +5,17 @@ import { getCollection } from "astro:content";
const entries = await getCollection("glossaire"); const entries = await getCollection("glossaire");
entries.sort((a, b) => a.data.term.localeCompare(b.data.term, "fr")); entries.sort((a, b) => a.data.term.localeCompare(b.data.term, "fr"));
--- ---
<SiteLayout title="Glossaire archicratique"> <SiteLayout title="Glossaire archicratique">
<h1>Glossaire archicratique</h1> <h1>Glossaire archicratique</h1>
<ul> <ul>
{entries.map((e) => ( {entries.map((e) => (
<li><a href={`/glossaire/${e.slug}/`}>{e.data.term}</a> — <em>{e.data.definitionShort}</em></li> <li>
<a href={`/glossaire/${String(e.id).replace(/\.(md|mdx)$/i, "")}/`}>
{e.data.term}
</a>{" "}
— <em>{e.data.definitionShort}</em>
</li>
))} ))}
</ul> </ul>
</SiteLayout> </SiteLayout>