Add migrate command for initializing open-next for existing Next.js projects#1083
Add migrate command for initializing open-next for existing Next.js projects#1083
migrate command for initializing open-next for existing Next.js projects#1083Conversation
🦋 Changeset detectedLatest commit: 608b497 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 |
commit: |
|
@vicb right now if an incorrect version of Next.js is used we get this: probably we should check the version and handle it more gracefully, right? or shall we even try to bump the version? what do you think? |
vicb
left a comment
There was a problem hiding this comment.
A lot of nits.
Also I realize that not having a monorepo makes it much harder to discover utils.
Should hopefully be fixed soon
There was a problem hiding this comment.
Same comment about moving the detection than for the wrangler config
There was a problem hiding this comment.
does this work?
There was a problem hiding this comment.
It works.
I usually add a "maybe" in the mix if it can return undefined or throw when there is no "maybe"
There was a problem hiding this comment.
Also would be nice if the API is consistent for the different files
There was a problem hiding this comment.
I usually add a "maybe" in the mix if it can return undefined or throw when there is no "maybe"
The return type make it clear to me so adding a maybe feels unnecessary to me, but I'm happy to add that since it's your preference 👍
Also would be nice if the API is consistent for the different files
I thought the same when implementing the two solutions... but having a return from a function that is never actually used feels ugly/potentially confusing to me, but it's not a huge deal, I'm totally happy to use a consistent API 👍
There was a problem hiding this comment.
The return type make it clear to me so adding a maybe feels unnecessary to me, but I'm happy to add that since it's your preference 👍
When you review code on GH, you don't get to see the return type easily
I thought the same when implementing the two solutions... but having a return from a function that is never actually used feels ugly/potentially confusing to me, but it's not a huge deal, I'm totally happy to use a consistent API 👍
I need to double check the code here, I thought it was used
|
Could you please merge master in this PR instead of rebasing? |
8bc4f63 to
87e3b01
Compare
init command for initializing open-next for existing Next.js projectsmigrate command for initializing open-next for existing Next.js projects
Co-authored-by: Victor Berchet <victor@suumit.com>
Co-authored-by: Victor Berchet <victor@suumit.com>
Co-authored-by: Victor Berchet <victor@suumit.com>
Co-authored-by: Victor Berchet <victor@suumit.com>
Co-authored-by: Victor Berchet <victor@suumit.com>
fb72a97 to
608b497
Compare

Fixes https://jira.cfdata.org/browse/DEVX-2383
Docs PR: opennextjs/docs#205
This PR addes a new
migrateCLI command that adds the OpenNext adapter to standard Next.js projects (this basically automates the steps in https://opennext.js.org/cloudflare/get-started).You can manually test this command by running:
to create a new Next.js project, cd into the project:
cd my-next-appinstall a compatible version of Next.js:
and then run the
initcommand:You should see something like the following:

Thanks to @2u841r to spearheading this effort 🫶