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 support to @astrojs/cloudflare directory deploy mode #3806

Merged
merged 3 commits into from
Aug 8, 2022

Conversation

nrgnrg
Copy link
Contributor

@nrgnrg nrgnrg commented Jul 3, 2022

Changes

Cloudflare Pages has 2 different ways of deploying a worker, the default mode which looks for a functions folder in the project root and an advanced mode which uses a _worker.js in the dist directory.

Different frameworks have opted for different approaches: Sveltkit targets advanced mode where as SolidStart and Qwik both target the functions directory.

Advanced mode provides a more consistant experience for users since the entire project gets built into the dist folder which is familiar. However the limitation of this is that pages plugins can't be used. As I see it a major use case for pages plugins is for enabling things like Sentry, especially in the absence of any logs on the pages platform right now.

This change adds an option to the adaptor to enable uses to change the default advanced deploy mode to the functions folder model which would allow the use of pages plugins and middleware. This mode creates a new functions folder in the project root where users can add plugins.

Testing

Docs

Updated readme

@changeset-bot
Copy link

changeset-bot bot commented Jul 3, 2022

🦋 Changeset detected

Latest commit: a1aa4a8

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

This PR includes changesets to release 1 package
Name Type
@astrojs/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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jul 3, 2022
@nrgnrg
Copy link
Contributor Author

nrgnrg commented Jul 19, 2022

@natemoo-re @tony-sull

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

@matthewp
Copy link
Contributor

@nrgnrg sorry for the late review. Would you mind rebasing with main? We can then get this in.

@nrgnrg nrgnrg force-pushed the feat/directory-mode branch 4 times, most recently from ea9cce4 to 6c05ac4 Compare July 27, 2022 21:05
@isaac-mcfadyen
Copy link
Contributor

Very happy to see this change: I was actually just discussing the merits of [[path]].ts vs _worker.js the other day and this is one of the things that came up.

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

LGTM once tests are passing!

@natemoo-re natemoo-re merged commit f4c571b into withastro:main Aug 8, 2022
@astrobot-houston astrobot-houston mentioned this pull request Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants