feat: add migrate command to set up OpenNext.js for Existing Next.js apps#1004
feat: add migrate command to set up OpenNext.js for Existing Next.js apps#10042u841r wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: e7b6473 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
| } | ||
|
|
||
| // Step 3: Create/update wrangler.jsonc | ||
| console.log("⚙️ Creating wrangler.jsonc..."); |
There was a problem hiding this comment.
That's something that we already do, see https://github.com/opennextjs/opennextjs-cloudflare/tree/main/packages/cloudflare/templates
There was a problem hiding this comment.
"services": [
{
"binding": "WORKER_SELF_REFERENCE",
// The service should match the "name" of your worker
"service": "my-app",
},
],missing in templates/wrangler.jsonc
also- comments/explanation only for r2_buckets, not other keys.
while in docs comments for almost all keys/values + "services" key is there.
vicb
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Definitely a good idea but the implementation needs some work.
(I'll comment further later)
Thanks for the feedback! |
|
Hi @2u841r thank you very much for the PR, I took your changes and expanded on them in #1083. From your previous message it sounded like this would be something you'd be happy with, I really hope you don't mind 🙏 I've made various changes such as updating the command's name from Please feel free to check 1083 and to put any comments or any feedback you have there 🙏 |
This PR introduces a new CLI workflow that automates the 10+ step migration process for existing Next.js applications moving to OpenNext.js for Cloudflare.
What’s included
Adds support for:
Automatically generates or updates all required files for Cloudflare deployment:
wrangler.jsoncopen-next.config.ts.dev.varsdev,deploy, etc.)Detects whether the project uses the Edge runtime and configures accordingly.
Provides an interactive package manager selector with keyboard navigation:
Performs a full end-to-end setup with zero manual steps.
Why this is useful
The existing migration guide requires following more than 10 manual steps. This flow automates the entire process, reducing setup time from several minutes to just a few seconds.
It ensures consistency, prevents misconfiguration, and improves the onboarding experience for developers migrating their existing projects.
Notes