Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add platformProxy option to configure getPlatformProxy #12011

Merged
merged 16 commits into from
Apr 8, 2024
Merged

feat: add platformProxy option to configure getPlatformProxy #12011

merged 16 commits into from
Apr 8, 2024

Conversation

vnphanquang
Copy link
Contributor

@vnphanquang vnphanquang commented Mar 21, 2024

Note

I've run check & lint but not all test scripts because I don't see any specific tests in the two packages' package.json, and some of tests fail on my machine (chromium-dev related) but I don't think they are related to the change here.

Context

Today, adapter-cloudflare and adapter-cloudflare-worker use Wrangler API's getPlatformProxy for platform emulation during dev & preview, but not yet allow passing configuration parameter to getPlatformProxy. This PR adds a platformProxy adapter option to do just that.

Use case

My specific use case is to set persist.path to a custom directory (equivalent to the --persist-to flag when using wrangler CLI). This allows me to set up two SvelteKit projects in a monorepo to use the same local sqlite database during dev & preview.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Mar 21, 2024

🦋 Changeset detected

Latest commit: deab0fd

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

This PR includes changesets to release 2 packages
Name Type
@sveltejs/adapter-cloudflare-workers Minor
@sveltejs/adapter-cloudflare 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

@eltigerchino eltigerchino changed the title Allow passing config to getPlatformProxy via a new platformProxy option feat: add platformProxy option to configure getPlatformProxy Mar 22, 2024
@vnphanquang vnphanquang requested a review from benmccann April 3, 2024 15:32
@hrueger
Copy link

hrueger commented Apr 5, 2024

Also very interested in this 👍 Is there anything that can be done to move this forward?

My use case is the following (I believe it is not that uncommon):
I have multiple sveltekit apps in a monorepo. They all share the same bindings, so the wrangler data folders need to be at the root of the monorepo, not in each single package. This can be configured in the options of getPlatformProxy(), therefore this PR would fix that issue 🎉

@AskingQuestions
Copy link

Also very interested in this 👍 Is there anything that can be done to move this forward?

My use case is the following (I believe it is not that uncommon): I have multiple sveltekit apps in a monorepo. They all share the same bindings, so the wrangler data folders need to be at the root of the monorepo, not in each single package. This can be configured in the options of getPlatformProxy(), therefore this PR would fix that issue 🎉

+1 to this. Same exact use case over here. I'm currently using a patched version of the adapter-cloudflare package to workaround this.

@eltigerchino
Copy link
Member

eltigerchino commented Apr 8, 2024

Thank you! (and sorry this took so long)

@github-actions github-actions bot mentioned this pull request Apr 8, 2024
@vnphanquang
Copy link
Contributor Author

Thank you team 🎉

@hrueger

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants