fix(cli): add the desktop engine an existing config imports in e2e init

Closed
KD
5d ago
+27-6

What

e2e init on a project whose existing config imports @e2e-dev/desktop adds @e2e-dev/desktop and @e2e-dev/core to package.json, as it already does for the web, mobile, and Electron engines.

Why

init knew only the engines that have a scaffold preset. The desktop engine has none, so for a config that imports it, init added no engine to package.json, and npm install then left the config unable to load.

How it works

  1. packages/e2e/scripts/write-sibling-versions.ts records the @e2e-dev/desktop version in dist/cli/init/sibling-versions.json at build time, beside the other engines.
  2. importedDependencies in packages/e2e/src/cli/init/config-dependencies.ts counts @e2e-dev/desktop as an engine next to the presets' engines. An import of it adds the engine at the recorded range, and @e2e-dev/core with it.
  3. docs/reference/cli.mdx lists the Electron and desktop engines among the packages init adds for a config's imports. The list named web and mobile only, though main already adds Electron. AGENTS.md says the desktop engine counts though it has no preset.

Verified

Ran it locally: yes

Scratch project with its own git root, a package.json with e2e only, and an e2e.config.ts that imports desktop from @e2e-dev/desktop. I ran CI=1 e2e init --yes --skills none --mcp none once with main's build and once with this branch's:

mainthis PR
devDependencies after init{ "e2e": "*" }{ "@e2e-dev/core": "^0.25.0", "@e2e-dev/desktop": "^0.0.1", "e2e": "*" }

The new unit test in cli-init.test.ts fails with main's config-dependencies.ts and passes with this one.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Rerunning e2e init on an existing config now adds the desktop engine and its required core package to package.json when they’re imported.
  • Documentation

    • Clarified which engine packages e2e init adds when checking an existing config.