Upgrade: v0.1.0-beta to v0.2.0-beta
This guide walks you through every change between Velocity v0.1.0-beta and v0.2.0-beta.
Overview
Section titled “Overview”| v0.1.0-beta | v0.2.0-beta | |
|---|---|---|
| Astro | 6.0.0-beta.5 | 6.0.0-beta.9 |
| Package manager | npm | pnpm |
| Zod | Standalone zod package | astro/zod (Zod 4) |
| SEO | astro-seo package | Native <meta> tags |
| CSP | Not configured | Enabled with allowlists |
| Env vars | import.meta.env | astro:env (type-safe) |
| @astrojs/mdx | v4 | v5 beta |
| @astrojs/react | v4 | v5 beta |
Prerequisites
Section titled “Prerequisites”- Node.js >= 22.12.0
- pnpm installed globally (
npm install -g pnpm)
Migration Steps
Section titled “Migration Steps”-
Switch to pnpm
Remove
package-lock.jsonand install with pnpm:Terminal window rm package-lock.jsonpnpm install -
Update dependencies
Bump Astro and integration packages, and remove packages that are no longer needed:
Terminal window pnpm add astro@6.0.0-beta.9 @astrojs/mdx@5.0.0-beta.1 @astrojs/react@5.0.0-beta.1pnpm remove zod astro-seo -
Remove legacy ESLint
--extflagsThe
--extflag was removed in ESLint v9. Update yourpackage.jsonscripts:"lint": "eslint . --ext .js,.ts,.astro""lint": "eslint ." -
Migrate zod imports
Astro 6 bundles Zod 4 internally. Replace all standalone
zodimports:import { z } from 'zod';import { z } from 'astro/zod';This applies to API routes (
src/pages/api/*.ts) and anywhere else you importz. -
Update Zod 4 API calls
Zod 4 changed several method signatures:
// Email validation is now a top-level typez.string().email()z.email()// ZodError property renamederror.errorserror.issues -
Remove
experimental.contentIntellisenseflagThis flag was stabilized in Astro 6 beta.9. Remove it from
astro.config.mjs:experimental: {contentIntellisense: true,}, -
Fix duplicate canonical URL
Remove the manual canonical link from
BaseLayout.astro— the SEO component now handles it:<link rel="canonical" href={canonicalURL} /> -
Replace
astro-seowith native meta tagsThe
astro-seopackage is replaced with a nativeSEO.astrocomponent. Updatesrc/components/SEO.astro:Before (v0.1.0-beta):
---import { SEO } from 'astro-seo';// ... props---<SEOtitle={title}description={description}openGraph={{ basic: { title, type: "website", image: ogImage } }}twitter={{ card: "summary_large_image" }}/>After (v0.2.0-beta):
---// No external dependency neededconst { title, description, ogImage, canonicalURL } = Astro.props;---<title>{title}</title><meta name="description" content={description} /><link rel="canonical" href={canonicalURL} /><!-- Open Graph --><meta property="og:title" content={title} /><meta property="og:description" content={description} /><meta property="og:type" content="website" /><meta property="og:image" content={ogImage} /><meta property="og:url" content={canonicalURL} /><!-- Twitter Card --><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content={title} /><meta name="twitter:description" content={description} /><meta name="twitter:image" content={ogImage} /> -
Add
astro:envconfigurationReplace raw
import.meta.envusage with type-safeastro:env. Add the env schema toastro.config.mjs:import { defineConfig, envField } from 'astro/config';export default defineConfig({env: {schema: {SITE_URL: envField.string({ context: 'server', access: 'public', optional: true }),PUBLIC_GA_MEASUREMENT_ID: envField.string({ context: 'client', access: 'public', optional: true }),PUBLIC_GTM_ID: envField.string({ context: 'client', access: 'public', optional: true }),},},// ...});Then update your imports:
const gaId = import.meta.env.PUBLIC_GA_MEASUREMENT_ID;import { PUBLIC_GA_MEASUREMENT_ID } from 'astro:env/client'; -
Enable CSP with explicit allowlists
Add Content Security Policy to
astro.config.mjs:export default defineConfig({security: {csp: true,},});Astro auto-hashes inline scripts and styles. If you use external resources (Google Fonts, analytics scripts, etc.), add explicit directives:
security: {csp: {"script-src": ["https://www.googletagmanager.com"],"style-src": ["https://fonts.googleapis.com"],"font-src": ["https://fonts.gstatic.com"],"connect-src": ["https://www.google-analytics.com"],},},
Verify the Upgrade
Section titled “Verify the Upgrade”Run the full verification suite:
pnpm build && pnpm lint && pnpm checkAlso manually verify:
- Pages render without console errors
- Contact and newsletter forms still validate correctly
- Analytics scripts load (if configured)
- Fonts and external resources load under CSP
Removed Dependencies
Section titled “Removed Dependencies”| Package | Reason |
|---|---|
zod | Replaced by astro/zod (bundled with Astro 6) |
astro-seo | Replaced by native <meta> tags in SEO.astro |
Removed Files
Section titled “Removed Files”| File | Reason |
|---|---|
package-lock.json | Switched to pnpm (pnpm-lock.yaml) |
env.d.ts | No longer needed with astro:env |
Next Steps
Section titled “Next Steps”- Changelog — Full release notes for v0.2.0-beta
- Environment Variables —
astro:envconfiguration reference - SEO Components — Native SEO component docs