Skip to content

feat(cli): ship migrate-v2 from main - #9178

Merged
maiieul merged 2 commits into
mainfrom
claude/focused-heisenberg-mp5m0s
Oct 23, 2026
Merged

maiieul merged 2 commits into
mainfrom
claude/focused-heisenberg-mp5m0s

Conversation

@wmertens

@wmertens wmertens commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

What is it?

  • Feature / enhancement

Description

qwik migrate-v2 has only been developed and published on the v1 branch, where it ships inside @builder.io/qwik. This PR moves it to main so it ships with @qwik.dev/core. That way a fix to the migration doesn't need a v1 release, and the migration always targets the v2 version it ships with.

Related PRs:

Commits:

  1. build(cli): bundle semver and ignore, load ts-morph from the project. The v1 code imports these at the top of the file. In main's ESM cli.mjs, a top-level import of an external package would come back as chore: update pnpm-lock.yaml and package.json to include ts-morph and… #8507: every qwik command crashes when those packages are missing. semver and ignore are small, so they are now bundled. ts-morph goes through a lazy createRequire(process.cwd()), which only runs when the migration starts. This is also what lets npx @qwik.dev/core@latest migrate-v2 work: the CLI then lives in the npx cache, and it has to find the ts-morph that the migration installs into the user's project.

  2. feat(cli): port the v1 migrate-v2 command. packages/qwik/src/cli/migrate-v2 is copied from origin/v1, with two small changes:

    • Two import-name lookups are narrowed to identifiers, because main's ts-morph 27 also types import specifier names as string literals.
    • visitNotIgnoredFiles now returns /-separated paths on every OS. On Windows it returned \ paths, so /routes/ and path-marker checks never matched: error-boundary renames and some warnings and next steps were silently skipped. v1 CI only ran the unit tests on Linux, so it never caught this. Main's Windows unit-test job did.

    Main's older edits to this folder are superseded: the lazy imports are now handled by the build change, and v1 deliberately reverted the jsxs/jsx-runtime rewrite in db9934f. run-migration.starters.unit.ts is left out because it copies the repo's starters, and main's starters are already v2. The qwik-local/loop-style lint rule is skipped for this folder. It is a runtime perf rule, and skipping it keeps the code close to v1, which makes the port easy to check.

Verification:

  • pnpm vitest run packages/qwik/src/cli: 152 tests passed. CI's Linux and Windows unit-test jobs pass.
  • pnpm build.core, which includes tsc -p packages/qwik/tsconfig.json, passes with no generated-file changes. pnpm eslint packages/qwik/src/cli, prettier and pnpm tsc.check are clean.
  • Importing cli.mjs from a directory with no node_modules failed with "Cannot find package 'ignore'" before commit 1 and works after it.
  • End to end with the published preview: npx https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9178 migrate-v2 on a v1 base + playground starter (Vite ^7.3.7) installed ts-morph 23 into the project, migrated, removed ts-morph, bumped Vite to ^8.0.0 and installed @qwik.dev/core. No @builder.io references were left in the code or config, and vite build passes on the migrated app.

Checklist

  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I added new tests to cover the fix / functionality (ported the v1 suite)

🤖 Generated with Claude Code

https://claude.ai/code/session_01WiKN3vtED6Tfy49qCcsKqN

Keeps the CLI loadable without the migrate-only dependencies even when
they are imported statically, and lets migrate-v2 find the ts-morph it
installs when the CLI runs outside the project (npx).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiKN3vtED6Tfy49qCcsKqN
@wmertens
wmertens requested review from a team as code owners October 7, 2026 07:54
@changeset-bot

changeset-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5cecd98

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/core Minor
@qwik.dev/devtools Minor
eslint-plugin-qwik Minor
@qwik.dev/mcp Minor
@qwik.dev/react Minor
@qwik.dev/router Minor
@qwik.dev/utils Minor
create-qwik Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wmertens
wmertens force-pushed the claude/focused-heisenberg-mp5m0s branch from 3a92ad5 to bd106a3 Compare October 7, 2026 09:23
@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9178

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9178

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9178

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9178

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9178

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9178

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9178

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9178

commit: 5cecd98

Copies packages/qwik/src/cli/migrate-v2 from the v1 branch so the
migration ships from @qwik.dev/core. The v1 starters test is left out
because main's starters are already v2.

Import names are narrowed to identifiers for ts-morph 27, whose
import specifier names can also be string literals.

visitNotIgnoredFiles returns `/`-separated paths so the path checks
also work on Windows, which v1 CI never ran the unit tests on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiKN3vtED6Tfy49qCcsKqN
@wmertens
wmertens force-pushed the claude/focused-heisenberg-mp5m0s branch from bd106a3 to 53b4a79 Compare October 7, 2026 09:32
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 5cecd98

@maiieul

maiieul commented Oct 23, 2026

Copy link
Copy Markdown
Member

LGTM

@maiieul
maiieul merged commit 9aa8c51 into main Oct 23, 2026
@maiieul
maiieul deleted the claude/focused-heisenberg-mp5m0s branch October 23, 2026 19:19
@github-project-automation github-project-automation Bot moved this from Waiting For Review to Done in Qwik Development Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants