Skip to content

chore: upgrade Astro to v6.1.2#630

Closed
davlgd wants to merge 1 commit into
satnaing:mainfrom
davlgd:davlgd-upgrade-astro-v6
Closed

chore: upgrade Astro to v6.1.2#630
davlgd wants to merge 1 commit into
satnaing:mainfrom
davlgd:davlgd-upgrade-astro-v6

Conversation

@davlgd

@davlgd davlgd commented May 3, 2026

Copy link
Copy Markdown
Contributor

Description

Upgrades Astro from 5.16.6 to 6.1.2, following the official Astro v6 Migration Guide.

Dependency bumps

Package From To Reason
astro ^5.16.6 ^6.1.2 Major upgrade (Vite 7, Zod 4, Shiki 4, Node ≥ 22.12)
@astrojs/rss ^4.0.14 ^4.0.18 Required for Zod 4 compatibility (was breaking the build on /rss.xml with z.function(...).returns is not a function)
@astrojs/sitemap ^3.6.0 ^3.7.2 Required for Zod 4 compatibility
@shikijs/transformers ^3.20.0 ^4.0.2 Aligns with Shiki 4 bundled in Astro 6

Configuration changes

  • astro.config.ts
    • Moved fonts out of experimental — the Fonts API is now stable in v6.
    • Removed experimental.preserveScriptOrder — preserved source order is the new default in v6, so the flag has been removed from the experimental API; dropping it keeps the current behavior.
    • Removed the obsolete @ts-ignore on the tailwindcss() Vite plugin: the upstream issue (withastro/astro#14030) is resolved with Vite 7 support in Astro 6.
  • src/content.config.ts
    • Replaced the deprecated z re-export from astro:content with an import from astro/zod, as recommended by the migration guide.

Types of changes

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Documentation Update (if none of the other choices apply)
  • Others (any other types not listed above) — dependency upgrade / migration

Checklist

  • I have read the Contributing Guide
  • I have added the necessary documentation (if appropriate)
  • Breaking Change (fix or feature that would cause existing functionality to not work as expected) — Node.js ≥ 22.12 is now required at build time

Further comments

Build verification

With local Node.js 24 LTS

✅ pnpm install              – clean
✅ pnpm sync                 – content synced, types generated
✅ pnpm exec astro check     – 0 errors / 0 warnings / 0 hints (50 files)
✅ pnpm run build            – 43 pages built
✅ Pagefind                  – search index generated (16 indexed pages, 2218 words)
✅ Sitemap                   – generated
✅ pnpm lint                 – clean

Breaking changes reviewed

  • Node.js ≥ 22.12.0 — verified.
  • Vite 7.0 — no custom Vite plugins affected; tailwindcss() works without the previous @ts-ignore workaround.
  • Zod 4 — content collection schemas validated; @astrojs/rss and @astrojs/sitemap bumped to versions that already use Zod 4.
  • Shiki 4 — @shikijs/transformers aligned to v4.
  • Legacy content collections removed — already on the Content Layer API.
  • Astro.glob() / <ViewTransitions /> removed — not used in source code.

Out of scope (suggested follow-ups)

These are stable v6 capabilities that AstroPaper could benefit from but are intentionally not included in this PR to keep the migration reviewable:

  • security.csp — built-in Content Security Policy with automatic hashing of bundled scripts/styles. A natural fit for a blog template; would need a small allowlist if Giscus / analytics are enabled.
  • prerenderConflictBehavior: "error" — fails the build when two routes generate the same prerendered URL (e.g. a post slug colliding with a tag).

Related documentation

Related Issue

Closes: #626

@satnaing

Copy link
Copy Markdown
Owner

Thanks for putting this together.
AstroPaper has been rewritten and upgraded for Astro v6.
Thus, closing this for now.
Really appreciate the effort on the migration work. ✌🏼

@satnaing satnaing closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Upgrade Astro to v6.1.2

2 participants