Repository navigation
feat: run project setup when migrating a Wrangler project - #817
edmundhung wants to merge 3 commits into
Conversation
1bab04b to
0f88aaf
Compare
commit: |
|
LGTM |
|
| mean | stddev | min | max | |
|---|---|---|---|---|
| PR | 283.0 ms | 4.7 ms | 277.4 ms | 294.5 ms |
| base | 282.7 ms | 3.5 ms | 277.2 ms | 290.5 ms |
Δ (PR vs base): — +0.3 ms (+0.1%)
Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.
|
LGTM! |
|
Review: 1 findings. |
|
No new concerns since the last review |
|
LGTM |
e4e65b5 to
5d62120
Compare
|
Review: 1 findings.
|
5d62120 to
ae746fc
Compare
|
🤖 I've done a thorough review of your PR.
|
ae746fc to
1f7bcec
Compare
|
Review: 1 findings. Posted 1 inline finding. |
|
No new concerns since the last review |
|
No new concerns since the last review |
|
Review: 1 findings. Posted 1 inline warning. |
|
No new concerns since the last review |
cf migrate, and the migration that cf dev, cf build and cf deploy offer, now detect the project, migrate its Worker settings to cloudflare.config.ts, run project setup, then migrate its build settings for the bundler that setup chose. cf no longer depends on @cloudflare/codemods.
Autoconfig reads a named Wrangler config itself.
Autoconfig only asks about a Wrangler assets directory that Vite won't deploy.
411e583 to
3805905
Compare
|
No new concerns since the last review |
There was a problem hiding this comment.
💬 Approved with comments — The four-step migration flow works as described. One WARNING: if project setup or the bundler step fails after cloudflare.config.ts has been written, the project is left half-migrated, and later cf dev/cf build/cf deploy runs skip setup.
Findings: 1 warning (1 is an inline comment on the diff)
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
🔧 Fix with your agent
Paste the following into your coding agent to investigate and fix these issues.
Fix the following code review issues found in pull request #817.
Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
## WARNING (1)
### [Code Quality] If `configureProject` or `migrateBundler` throws after `migrateWranglerConfig` has written `cloudflare.config.ts`, the project is left half-migrated, and `prepareProject` then treats it as configured and skips setup.
- **File:** packages/cli/src/lib/wrangler-migration.ts:204
📋 Code Quality: ⚠️ 1 warning
The move to autoconfig's step-by-step migration is sound overall. A failure partway through can leave the project half-migrated.
Recommendation: 📝 Minor Comments
- [WARNING] If
configureProjectormigrateBundlerthrows aftermigrateWranglerConfighas writtencloudflare.config.ts, the project is left half-migrated, andprepareProjectthen treats it as configured and skips setup. (packages/cli/src/lib/wrangler-migration.ts:204)
View full review
A failure partway through leaves the project half-migrated (packages/cli/src/lib/wrangler-migration.ts:196-231)
migrateWranglerConfigwritescloudflare.config.tsbeforeconfigureProjectandmigrateBundlerrun. The old codemod did all of this in a single call.configureProjectinstalls packages, so it can throw on an install failure or a cancelled prompt.migrateBundlercan also reject. Either way,cloudflare.config.tsstays on disk but setup and the build migration never happen.- On the next
cf dev,cf buildorcf deploy,prepareProject(packages/cli/src/lib/autoconfig.ts:173-176) seesdetails.configuredand returns early. It skips both framework setup and the migration offer, so the project is never finished. - Possible fixes: catch failures after step 2 and tell the user which steps finished and how to resume, or make the later steps safe to retry. A test where
configureProjectrejects would cover this.
Checks that found no issue: how --bundler and setup's bundler interact (warning, then setup wins); --no-install falling back to declared-plugin detection; no framework detected and the static framework skipping setup; changedFiles deduplication and merging of followUps and status; removal of @cloudflare/codemods from package.json and the lockfile; agreement between meta.ts and the regenerated commands.json and hand-written-commands.json.
✅ All other checks passed
🚀 Release: ✅ LGTM
The changeset is present and suits a user-facing feature.
🔒 Security: ✅ LGTM
No security concerns in this change.
📖 AGENTS.md: ✅ LGTM
No issues in the files this pull request changes.
📝 Documentation: ✅ LGTM
The changeset and the regenerated command metadata match the new behaviour.
Reviewed commit: 38059051
cf migrate, and the migration offer incf dev,cf buildandcf deploy, now run four steps: detect the project, migrate its Worker settings tocloudflare.config.ts, run project setup with autoconfig, then migrate its build settings for the bundler that setup chose. Setup's bundler wins over--bundler, with a warning, and--no-installskips setup.cf no longer depends on
@cloudflare/codemods.