Skip to content

Upgrade to Astro 6 + Vite 7 + Tailwind v4 (supersedes #93)#98

Merged
hasparus merged 5 commits into
mainfrom
astro-6-upgrade
Jun 13, 2026
Merged

Upgrade to Astro 6 + Vite 7 + Tailwind v4 (supersedes #93)#98
hasparus merged 5 commits into
mainfrom
astro-6-upgrade

Conversation

@hasparus

@hasparus hasparus commented Jun 13, 2026

Copy link
Copy Markdown
Owner

What

Upgrades the framework so the @astrojs/solid-js 6 bump (PR #93) lands on its supported pairing instead of running one major ahead of the framework.

  • Astro 5.17 → 6.4.6 (brings Vite 6 → 7)
  • Tailwind CSS 3 → 4 (via @tailwindcss/upgrade)
  • @astrojs/mdx 4 → 6, @astrojs/markdown-remark 6 → 7, @astrojs/solid-js 5 → 6, @astrojs/sitemap 3.7.3
  • Drops the deprecated @astrojs/tailwind integration (v3-only; unsupported on Astro 6)

Supersedes #93 — the solid-js 6 bump is included here on its correct Astro 6 / Vite 7 stack.

Notable changes

  • Tailwind v4: kept the existing JS config via @config in base.css; added @reference to every isolated stylesheet (CSS modules, JS-imported CSS, Astro scoped <style>) so @apply resolves. PostCSS now uses @tailwindcss/postcss (before cssnano).
  • Image.astro: the build-time placeholder lookup resolved the source image via an import.meta.url path hack tied to Astro 5's emitted chunk layout. Astro 6's new .prerender/chunks/ layout broke it (ENOENT dist/src/images/...). Now resolved from the project root (process.cwd()), independent of output layout.
  • Visual snapshots: Tailwind v4 Preflight shifts text baselines ~1px (over the 0.02 tolerance); layout/colors/fonts unchanged. Regenerated -darwin (local) and -linux (Playwright v1.60.0 container, matching CI).

Verification

  • pnpm build (prod), pnpm typecheck, pnpm lint
  • ✅ Functional e2e (site.spec.ts, agent-ready.spec.ts) on desktop + mobile — incl. the command-palette open/theme-switch flow
  • ✅ Visual regression regenerated and passing in a Linux Playwright container

Known follow-ups (non-blocking)

Astro 6 deprecation warnings (still functional, removed in a future major) — left for a focused follow-up to avoid touching the markdown/MDX pipeline here:

  • markdown.gfm → move onto a unified processor
  • mdx() remarkPlugins/rehypePluginsmarkdown.processor

Summary by CodeRabbit

  • New Features

    • Improved code-block rendering with an enhanced syntax transformer for richer annotations (explicit trigger).
  • Chores

    • Upgraded core framework and CSS tooling (Astro v6, Tailwind v4) and updated PostCSS integration.
  • Style

    • Global and component style adjustments for consistent borders, spacing, and corner radii; tweaks to headings, controls, keyboard/keycap appearance, links, progress indicator, image sizing, and layout positioning.

hasparus added 3 commits June 13, 2026 14:53
- run @tailwindcss/upgrade codemod (class renames, postcss → @tailwindcss/postcss)
- drop @astrojs/tailwind integration (v3-only, unsupported on Astro 6)
- keep existing JS config via @config directive in base.css
- add @reference to isolated CSS (modules, JS-imported, scoped <style>) so @apply resolves
- reorder postcss: @tailwindcss/postcss before cssnano

Still on Astro 5. Build + functional e2e (incl. command palette) green.
- astro ^6.4.6, @astrojs/mdx ^6, @astrojs/markdown-remark ^7,
  @astrojs/solid-js ^6, @astrojs/sitemap ^3.7.3
- fix Image.astro placeholder lookup: resolve source image from project
  root (process.cwd) instead of an import.meta.url path hack that depended
  on Astro 5's emitted chunk layout (broke under Astro 6 .prerender/chunks)

solid-js integration 6 is now on its supported Astro 6 / Vite 7 pairing.
Build, typecheck, lint, and functional e2e (desktop + mobile) green.

Known follow-ups (deprecation warnings, still functional in Astro 6.x):
- markdown.gfm deprecated -> move onto unified processor
- mdx() remarkPlugins/rehypePlugins -> markdown.processor
Tailwind v4 Preflight shifts text baselines by ~1px, exceeding the 0.02
diff tolerance. Layout/colors/fonts unchanged. Regenerated both -darwin
(local) and -linux (Playwright v1.60.0 container, matching CI) snapshots.
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 651de9d7-f452-4a28-963c-02e735a72968

📥 Commits

Reviewing files that changed from the base of the PR and between 7941f29 and 7f19cab.

📒 Files selected for processing (2)
  • src/lib/Commands.tsx
  • src/lib/Kbd.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/Kbd.tsx
  • src/lib/Commands.tsx

📝 Walkthrough

Walkthrough

Upgrade Astro and markdown tooling, migrate Tailwind v3→v4 (dependencies and PostCSS), centralize base CSS with @reference, adjust component Tailwind tokens/class utilities, refactor Image path resolution, and update markdown plugin typings and processor wiring.

Changes

Tailwind v4 Migration and Configuration

Layer / File(s) Summary
Build configuration and dependency upgrades
astro.config.ts, package.json, postcss.config.cjs
astro.config.ts adds transformerTwoslash, removes the Tailwind integration, and explicitly wires markdown.processor using unified({ remarkPlugins, rehypePlugins, gfm: true }). package.json bumps astro and @astrojs/* packages, replaces @astrojs/tailwind with @tailwindcss/postcss, bumps tailwindcss to v4, and removes autoprefixer. postcss.config.cjs replaces prior Tailwind plugin entries with @tailwindcss/postcss.
Global CSS base layer — Tailwind v4 migration
src/global-styles/base.css
Switches Tailwind inclusion to Tailwind v4 @import/@config style and adds an @layer base compatibility rule that sets fallback border colors using var(--color-gray-200, currentcolor) for common selectors.
Global stylesheets — @reference directives
src/global-styles/controls.css, src/global-styles/integrations.css, src/global-styles/shiki.css
Add @reference "./base.css" to global styles and fix missing/incorrect closing braces to ensure valid CSS blocks.
CSS modules — @reference directive additions
src/lib/prose/*, src/lib/prose/Image.css, src/lib/prose/prose.css
Add @reference ../../global-styles/base.css to prose-related CSS modules and correct end-of-file closing braces for structural consistency.
Component styling class updates
src/lib/prose/Blockquote.tsx, src/lib/Commands.tsx, src/lib/Link.tsx, src/lib/Kbd.tsx, src/lib/TableOfContents/PostProgressBar.tsx, src/lib/CommandCenter.tsx, src/layouts/PostLayout.astro
Update Tailwind utilities and tokens for v4 compatibility: rounded-smrounded-xs, focus/outline utilities adjusted (outline-noneoutline-hidden/outline-solid), dialog/top token changes, h1 margin precedence tweak, and translate/Y variable interpolation syntax change.
Image component path resolution and styling
src/lib/prose/Image.astro
Import join from node:path and refactor placeholder-image resolution to use process.cwd()+join(...) with leading-../ stripping; update wrapper sizing and image rounding Tailwind classes.
Astro components — @reference directives
src/lib/TableOfContents/TableOfContents.astro, src/pages/index.astro
Add @reference to component/page styles to include centralized base.css.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 From three to four our styles take flight,
Base rules gathered, borders set right.
Astro steps forward, plugins aligned,
Classes refined, paths redesigned.
A little hop—the site feels light!


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Accessible E2e Tests ❌ Error e2e/site.spec.ts uses class-based CSS selectors: page.locator("pre.astro-code") and "pre.astro-code span[style*='color']" (no data-testid usage). Update e2e tests to avoid class selectors (e.g., replace pre.astro-code with pre + span[style*='color']), and prefer getByRole/getByText where applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Upgrade to Astro 6 + Vite 7 + Tailwind v4 (supersedes #93)' accurately reflects the main changes across the entire PR, which involves upgrading the project stack to Astro 6, Vite 7, and Tailwind v4, along with corresponding dependency updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch astro-6-upgrade

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

69-69: ⚠️ Potential issue | 🔴 Critical

Update Vite to match Astro 6.4.6 (currently pinned to Vite 5)

Astro 6.4.6 requires Vite ^7.3.2, but package.json still has vite: ^5.2.12—this mismatch can break tooling and build behavior. Align the Vite devDependency to ^7.3.2 (or Astro’s required range) so the project uses the expected Vite major.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 69, package.json currently pins "vite" to ^5.2.12 which
conflicts with Astro 6.4.6; update the devDependency "vite" in package.json to
the version range required by Astro (e.g., "^7.3.2") so the project uses Vite
7.x and matches Astro's expectations, then run your package manager to
reinstall/update lockfile.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/Commands.tsx`:
- Line 158: The Tailwind open-state selector in the className string in Commands
(src/lib/Commands.tsx) is invalid: replace the nonstandard '[[open]]:flex' token
with a valid Tailwind variant such as 'open:flex' (or use the explicit attribute
form '[&[open]]:flex') inside the same className string so the dialog open state
correctly applies the flex rule.

In `@src/lib/Kbd.tsx`:
- Line 25: In src/lib/Kbd.tsx remove the leftover malformed selector fragment
"[&[data-pressed]]" from the concatenated class string (it is redundant because
the correct v4 variant "data-pressed:border-b" is already present); locate the
class construction in the Kbd component (the className string around
"data-pressed:border-b") and delete the stray "[&[data-pressed]]" token so the
resulting class string only includes valid Tailwind variants.

---

Outside diff comments:
In `@package.json`:
- Line 69: package.json currently pins "vite" to ^5.2.12 which conflicts with
Astro 6.4.6; update the devDependency "vite" in package.json to the version
range required by Astro (e.g., "^7.3.2") so the project uses Vite 7.x and
matches Astro's expectations, then run your package manager to reinstall/update
lockfile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e54dc41-4123-4f6b-9469-5a8776d3fa81

📥 Commits

Reviewing files that changed from the base of the PR and between e03c4cf and ff620e4.

⛔ Files ignored due to path filters (16)
  • e2e/visual-regression.spec.ts-snapshots/features-asides-desktop-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-asides-desktop-linux.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-asides-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-asides-mobile-linux.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-markdown-cheat-sheet-desktop-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-og-images-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-post-with-frontmatter-desktop-linux.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-post-with-frontmatter-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-post-with-frontmatter-mobile-linux.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-reading-time-desktop-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-reading-time-desktop-linux.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-reading-time-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/features-shiki-twoslash-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/index-mobile-darwin.png is excluded by !**/*.png
  • e2e/visual-regression.spec.ts-snapshots/index-mobile-linux.png is excluded by !**/*.png
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • astro.config.ts
  • package.json
  • postcss.config.cjs
  • src/global-styles/base.css
  • src/global-styles/controls.css
  • src/global-styles/integrations.css
  • src/global-styles/shiki.css
  • src/layouts/PostLayout.astro
  • src/lib/CommandCenter.tsx
  • src/lib/Commands.tsx
  • src/lib/Kbd.tsx
  • src/lib/Link.tsx
  • src/lib/TableOfContents/PostProgressBar.tsx
  • src/lib/TableOfContents/TableOfContents.astro
  • src/lib/prose/Blockquote.module.css
  • src/lib/prose/Blockquote.tsx
  • src/lib/prose/Heading.module.css
  • src/lib/prose/Image.astro
  • src/lib/prose/Image.css
  • src/lib/prose/Ol.module.css
  • src/lib/prose/Paragraph.module.css
  • src/lib/prose/Table.module.css
  • src/lib/prose/code-and-pre.module.css
  • src/lib/prose/prose.css
  • src/pages/index.astro
💤 Files with no reviewable changes (1)
  • astro.config.ts

Comment thread src/lib/Commands.tsx Outdated
Comment thread src/lib/Kbd.tsx Outdated
hasparus added 2 commits June 13, 2026 15:51
Resolves the two Astro 6 deprecation warnings:
- markdown.gfm -> unified({ gfm })
- mdx() remarkPlugins/rehypePlugins -> markdown.processor (MDX inherits via
  extendMarkdownConfig)

remark/rehype plugins and gfm now live on a single unified() processor;
syntaxHighlight/shikiConfig stay on markdown (passed through as shared opts).
Retyped build-time plugin exports to Astro's RemarkPlugins/RehypePlugins.

Verified: emitted HTML byte-for-byte identical to pre-migration build across
all pages; typecheck, lint, and full e2e (35 tests incl. visual regression)
green. No deprecation warnings remain.
@hasparus

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hasparus hasparus merged commit 100fd51 into main Jun 13, 2026
4 checks passed
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.

1 participant