Skip to content

feat: support passing options to init open-next cloudflare dev function#469

Merged
vicb merged 7 commits intoopennextjs:mainfrom
Juuldamen:feature/platform-proxy-options
Apr 1, 2025
Merged

feat: support passing options to init open-next cloudflare dev function#469
vicb merged 7 commits intoopennextjs:mainfrom
Juuldamen:feature/platform-proxy-options

Conversation

@Juuldamen
Copy link
Copy Markdown
Contributor

To allow same behaviour as setupDevPlatform() from next-on-pages. In this case I assume the removal of passing options was not intended. If not, are there any alternatives to the below?

import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";

initOpenNextCloudflareForDev({
  persist: {
    path: "../../.wrangler/state/v3/custom-dir",
  },
});

When testing with pnpm --filter playground15 preview the .wrangler directory is correctly created in the root of the project. But a .wrangler directory also appears within the playground15 directory. So I'm creating this PR so I can use a preview deployment to be able to test in my own app with D1. Or are there better ways to test in this repo itself?

image

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 17, 2025

🦋 Changeset detected

Latest commit: 0de0116

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

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

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

Comment thread packages/cloudflare/src/api/cloudflare-context.ts
@vicb
Copy link
Copy Markdown
Contributor

vicb commented Mar 17, 2025

@dario-piotrowicz or @james-elicx do you have history/insights from next on pages?

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 17, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@469

commit: 0de0116

@james-elicx
Copy link
Copy Markdown
Collaborator

do you have history/insights from next on pages?

Nothing too much, it was just that some people wanted the ability to further configure what wrangler was going to do, e.g. where data was persisted like in the example above.

@vicb vicb requested a review from dario-piotrowicz March 19, 2025 11:07
Copy link
Copy Markdown
Contributor

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch @Juuldamen, overall looks good to me 😄

Just a couple of quick non-blocking suggestions:

  • we should also update the open-next docs accordingly (we can take care of it if you don't want to 🙂)
  • ideally this should also be tested (in next-on-pages we didn't have anything set up for dev e2es but here we do, so it would be quite nice if this could be somehow tested)

PS: you have some merge conflicts to resolve

Comment thread packages/cloudflare/src/api/cloudflare-context.ts Outdated
Comment thread packages/cloudflare/src/api/cloudflare-context.ts Outdated
Comment thread .changeset/shaggy-bobcats-battle.md Outdated
@Juuldamen Juuldamen force-pushed the feature/platform-proxy-options branch from 3ab2f75 to b22548a Compare March 21, 2025 09:27
Copy link
Copy Markdown
Contributor

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ping @Juuldamen 🙏 , sorry I didn't realize this PR was waiting for my review

I'll keep an eye on if from now on 🙂

(I just left one last small comment)

@Juuldamen Juuldamen force-pushed the feature/platform-proxy-options branch from 1a630aa to ee1712e Compare March 27, 2025 11:14
@vicb vicb merged commit aef8e51 into opennextjs:main Apr 1, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants