feat(init): write a working config for Vite apps
[!NOTE]
Written with Claude Code (Claude Opus 5.5), prompted and iterated on by me. I've reviewed the code. Not slop, I promise.
What
e2e init now recognizes a Vite project, the way it already recognizes Next.js. The config it writes starts npm run dev on Vite's port, 5173 or the --port in the dev script, so the first npm run test:e2e passes.
Why
Today init writes http://localhost:3000 for a Vite app, so the first run fails with APP_UNREACHABLE until you fix the port by hand.
How it works
-
Refactor, no behavior change.
init/frameworks.tsbecomes a list of framework modules. Each hasclaims(manifest)anddetect(project), and the first module that claims a project handles it. Next.js moves toframeworks/nextjs.tsas it was. -
Vite in
frameworks/vite.ts. When init can't tell where the app runs, it keeps today's placeholder and prints the reason. That happens when:- a backend serves the app (Laravel, Symfony, Rails, Django)
- the dev server uses HTTPS
vite.config.*sets another port, or the script passes--configor another directory- the dev script doesn't run
vite(vite build --watch,react-router dev)
It reads each quoted command under a launcher on its own (
launchedCommandsinframeworks/scripts.ts). So inconcurrently "vite" "json-server --port 3001", init writes 5173, and json-server's port is never taken for Vite's. -
Docs. A "Vite apps" section in
docs/reference/cli.mdx, the setup skill, and a changeset.
Issue
Closes #2313
Verified
Ran locally: yes, on macOS with Node 26, npm, and Vite 8.3.8. I ran e2e init --yes and the first e2e run in fresh npm create vite projects:
| Project | main | this PR |
|---|---|---|
| React or Vue template | localhost:3000, run fails | 5173, run passes |
concurrently -k "vite" "json-server --port 3001" | run fails | 5173, run passes |
vite --port 4100 | run fails | 4100, run passes |
vite --clearScreen false | run fails | 5173, run passes |
| config sets port 3000, Laravel, or an HTTPS plugin | placeholder | placeholder, and init says why |
- Next.js gives the same result as on main for 300 combinations of
devandstartscripts. pnpm check, thee2eunit tests, andtests/integration/cli-init.test.tspass.- Not tested: pnpm, Yarn, or Bun; Linux or Windows; real SvelteKit or React Router projects.
- Not changed: Next.js reads a port from a quoted sibling command on main too (
concurrently "next dev" "json-server -p 3001"). Fixing that changes Next.js behavior, so I left it for a separate PR, which only has to switch Next.js fromcommandsOftolaunchedCommands.
Checklist
- Changeset added (
e2e, patch). - Breaking change: no.
- Docs updated:
docs/reference/cli.mdxandskills/e2e/references/setup.md. - Contract change: no public API or wire format changes.
- Engine contract change: no.
🤖 Generated with Claude Code