-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
chore(cloudflare): refactor structure, optimize patterns #8654
chore(cloudflare): refactor structure, optimize patterns #8654
Conversation
🦋 Changeset detectedLatest commit: 83499e6 The changes in this PR will be included in the next version bump. 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 |
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
a49d331
to
24d691a
Compare
@alexanderniebuhr very excited to see this work! This might be a dumb question, but it looks like there's a fair amount of work to get CF properly integrated for each service, and it feels that this might be hard to maintain if cloudflare makes service API changes. I wonder if you had explored ways either: a) Try to reuse code by importing parts of Wrangler for environment setup and service mocks |
@jadbox thank you so much for your message. Let me try to answer it as good as I can, but feel free to ask any additional details, if you wish.
This is not true. There is some work which we need to do, but it is not to much, don't get mislead by this PR. I'd recommend that you look into the D1, R2, KV bindings PR.
We are actually reusing as much code as possible, we also have a open request to get more APIs exposed. |
24d691a
to
ecf0487
Compare
371e533
to
4459a36
Compare
Hey @alexanderniebuhr, this may be out of scope, but I saw that Wrangler now injects a new AI binding that would be lovely to also have available. |
@jadbox good to know! Do you know if it is the same as Cloudflare constellation? Also please note that we currently focus on bindings which can be mocked locally, that is similar to using If you would need to run |
@alexanderniebuhr the docs are not clear, but I think your right that it's just Constellation and will require a remote flag for binding. Good to know that remote services will come in the second phase! God speed on phase 1 and looking forward to testing 🫡 |
b1cb44a
to
874a62b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alexanderniebuhr! I can see the new section added really incorporated some docs suggestions we've discussed before! 🙌
There's a bunch to go through here though (not all of it yours, but highlighted by the Wonderful World of Giff Diffs) so get ready for a real docs review incoming! 😄
1a3d27f
to
079acab
Compare
c34bcc4
to
ab663a6
Compare
ab663a6
to
c96c643
Compare
This comment was marked as outdated.
This comment was marked as outdated.
2388d0f
to
274dc33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more pass, and probably however you choose to handle these comments will be fine and not require another review by me! If you'd like me to have another look after you think you're finished, then just ping me again in docs-ptal, otherwise I'm confident you can run with these comments and you got this!
b6bc935
to
68a95a3
Compare
@alexanderniebuhr incredible stuff!!! 😍 I can't help but notice that DurableObjects aren't included in your set of PRs? is there a reason as to why? |
@dario-piotrowicz Thank you for your input. We're currently exploring the integration of DurableObjects. In this phase 1, we're prioritizing the addition of local bindings, analogous to the However, I'm facing challenges in devising tests for these, primarily because a shared DurableObject isn't available during testing. If you have any suggestions or insights on how we can effectively test them, I'd be eager to share my preliminary merge request for inclusion. |
Sorry I am not completely sure, I'm also wondering how you instantiate the DO for standard local development, which to me sounds like it should be as tricky, but that doesn't sound like an issue based on your message? 🤔 Anyways I've brought this up with the Miniflare author which will be much more suited then me to give you some insights/suggestions on what you can do 🙂 |
Hey @alexanderniebuhr! 👋 Thanks for working on this. I have a few questions on the Durable Objects stuff:
Are you having trouble devising tests for Durable Objects in particular, or all the local bindings?
Which shared object are you referring to here? Is this an object you were hoping to implement just for the test? Or an object provided by an Astro user? |
Actually just Durable Objects, all other bindings work perfectly fine. Let's move the discussion to Discord.
Exactly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the refactor!
68a95a3
to
8453a25
Compare
8453a25
to
798d018
Compare
Refactors server directory structure by creating `entrypoints` directory and moving `server.advanced` and `server.directory` into it. Changes all respective imports to reflect this movement. The server's code imports from `./util.js` are refactored to `../util.js` due to the server files' move into the `entrypoints` directory. In `index.ts`, cleans up unused imports, and refactors code by moving utility functions that were previously inline to the new `./utils` directory. The code refactoring and restructuring allows for easier navigation and enhancement. The server and utility functions separation follows the single responsibility principle, favoring modular design. The pattern optimization aids in a smoother deployment process by eliminating redundant patterns. --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: 100gle <loogle.space@gmail.com>
798d018
to
83499e6
Compare
Changes
Testing
Docs
/cc @withastro/maintainers-docs for feedback!