Skip to content

feat(cli): support SvelteKit setup#324

Open
maxffarrell wants to merge 5 commits into
aidenybai:mainfrom
maxffarrell:feat/sveltekit-support
Open

feat(cli): support SvelteKit setup#324
maxffarrell wants to merge 5 commits into
aidenybai:mainfrom
maxffarrell:feat/sveltekit-support

Conversation

@maxffarrell
Copy link
Copy Markdown

@maxffarrell maxffarrell commented May 4, 2026

Summary

  • adds SvelteKit automatic setup detection and transforms for src/hooks.client.ts
  • updates existing SvelteKit client hooks without duplicating the React Grab import
  • covers SvelteKit detection, transform, configure, and real SvelteKit app build behavior

Closes #231

Validation

  • nr build
  • nr format
  • nr lint
  • nr typecheck
  • nr test:cli
  • real SvelteKit 2 / Svelte 5 test project: react-grab init -y --skip-install, repeat init idempotency check, app build, and browser runtime smoke test for window.__REACT_GRAB__

Full root nr test was also run after installing Playwright Chromium. Package builds passed, but the existing Playwright suite failed in keyboard activation and copy-feedback coverage unrelated to the SvelteKit setup path: 540 passed, 17 failed, 2 flaky, 6 did not run.


Summary by cubic

Adds SvelteKit support to the CLI. It auto-detects @sveltejs/kit, injects a dev-only react-grab import into src/hooks.client.(ts|js) without duplication, and updates docs/CLI help with SvelteKit setup.

  • New Features

    • Detects sveltekit via @sveltejs/kit and removes it from unsupported; CLI framework choices updated.
    • Creates or updates src/hooks.client.ts/.js with if (import.meta.env.DEV) { void import("react-grab"); }.
    • Skips changes if react-grab already exists in hooks.client, src/app.html, or +layout.svelte.
    • Supports options via previewOptionsTransform by upgrading the dynamic import to .then((m) => m.init(...)) once.
    • Improves init diff preview when original content is missing and write-permission checks for new files.
    • Updates READMEs and website install guides with SvelteKit instructions.
  • Migration

    • In a SvelteKit app, run react-grab init. Re-running is safe and idempotent.

Written for commit 1bc0a3f. Summary will update on new commits.


Note

Medium Risk
Medium risk because it extends CLI project detection and file transforms to create/modify src/hooks.client.*, which could affect install/config behavior across frameworks if detection or idempotency edge cases are wrong.

Overview
Adds first-class SvelteKit support to grab init by detecting @sveltejs/kit projects and automatically injecting a dev-only react-grab dynamic import into src/hooks.client.(ts|js) (creating the file when missing and avoiding duplicates by also checking src/app.html).

Extends CLI option reconfiguration to update the SvelteKit dynamic import with .init({...}), improves diff/preview handling and write-permission checks for newly-created files, and updates docs/help text and tests to reflect SvelteKit being supported (not “unsupported”).

Reviewed by Cursor Bugbot for commit 1bc0a3f. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 4, 2026

@maxffarrell is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

@maxffarrell maxffarrell marked this pull request as ready for review May 4, 2026 02:45
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 14 files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

SvelteKit is not yet supported by automatic setup.

1 participant