feat(@astrojs/netlify): Add on-demand builders Netlify functions #5874
feat(@astrojs/netlify): Add on-demand builders Netlify functions #5874matthewp merged 8 commits intowithastro:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 39d5035 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 |
|
Very nice! Can you add a changeset? |
|
@matthewp There is a CI failure on macOS. It's related to a timeout in an Astro CLI test . I think this should not be impacted by this pull request. Thanks. |
|
@juanmiguelguerrero Yeah thanks, I believe that's a flaky test. I'll rerun. |
|
I found an error in the example code. This is the correct code: import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true
}),
});Note: I have edited the previous comment. |
|
@juanmiguelguerrero Here is the file that needs to be edited to add something to the docs Can you please document the necessary changes there, following the style of the other items at https://docs.astro.build/en/reference/configuration-reference/ ? Let me know if you need/want assistance with this. Then the docs team will review them! |
|
@sarah11918 I think there is nothing to change in that file. This code changes do not affect the general Astro configuration. They only affect the Netlify adapter configuration. The doc to update is this one: https://docs.astro.build/en/guides/integrations-guide/netlify/ In my opinion, the place to insert this change is inside the "Configuration" section, between the "dist" and "binaryMediaTypes" options. The text we should include would be something like this: buildersOn-demand Builders are serverless functions used to generate web content as needed that’s automatically cached on Netlify’s Edge CDN. To activate rendering with this type of functions, use the import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true
}),
});This functionality is only available whith the For more information about Netlify On-demand Builders visit the Netlify documentation. |
|
@juanmiguelguerrero Gotcha! In that case, you'll want to edit this page: https://github.com/withastro/astro/blob/main/packages/integrations/netlify/README.md This content is pulled into the Docs site from this README. Would you mind opening a PR with proposed changes there? Docs will get notification of that PR automatically, and that's where we can finalize the wording together. Thanks! |
|
@sarah11918 I have just updated the documentation. |
|
@matthewp Jhon, can you resolve these conflicts? @sarah11918 Have you seen the changes I made to the README? Are they correct? Can I help? Thanks... 🚀 |
sarah11918
left a comment
There was a problem hiding this comment.
Thanks for the ping to let me know this was updated! Here are my suggestions for documentation text, if they don't lose your original intention!
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
|
@matthewp I have already reviewed the pending conflicts. |
|
Thanks @juanmiguelguerrero! This is looking great. @sarah11918 just need your approval if there's nothing else. |
sarah11918
left a comment
There was a problem hiding this comment.
Docs is happy! Thanks @juanmiguelguerrero 🙌
|
Netlify on-demand builders allow setting a Time to Live duration – this can be very useful for content like e-commerce or larger CMS setups. Ideally this could be configured per route ( a. |
|
@betabong It is an interesting functionality and is not difficult to implement. My only doubt is how would be the best configuration option? I think the simplest is something like this: import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify({
builders: true,
ttl: 3600
}),
});Anyway I would like to know before the opinion of @matthewp |
|
Hey @juanmiguelguerrero I have made a pull request here #6219 Please have a look, thanks 🙏 |
* Add on-demand builders option * chore: add changeset * docs: add documentation in configuration section * Update packages/integrations/netlify/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/integrations/netlify/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/integrations/netlify/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/twenty-pans-agree.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

Changes
Testing
chai.Docs
/cc @withastro/maintainers-docs for feedback!