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: populate Blobs context in build plugins #5571

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

eduardoboucas
Copy link
Member

Summary

Populates the Blobs context in the build plugins execution environment, so that build plugins can interact with Blobs without having to initialise the client with access credentials and API addresses. It makes the experience consistent with the functions and edge functions entry points.

Closes COM-542.

@eduardoboucas eduardoboucas requested review from a team as code owners April 2, 2024 14:15
@@ -26,12 +26,12 @@ const setTimeoutPromise = promisify(setTimeout)
// response: json payload response (defaults to {})
// status: http status code (defaults to 200)
// wait: number used to induce a certain time delay in milliseconds in the response (defaults to undefined)
export const startServer = async (handler: ServerHandler) => {
export const startServer = async (handler: ServerHandler, port = 0) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Sometimes it's useful to know the port before starting the server, so this makes it possible for the consumer to specify the port that the server should use.

Copy link
Contributor

github-actions bot commented Apr 2, 2024

This pull request adds or modifies JavaScript (.js, .cjs, .mjs) files.
Consider converting them to TypeScript.

token?: string
}

// TODO: Move this work to a method exported by `@netlify/blobs`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Something I've done in the past is attach a ticket number to TODO comments. This helps ensures that the work gets finished, gives a space to provide more detailed context, and makes it easier for other people to pick up the work.

[
{
response: { url: `http://localhost:${serverPort}/some-signed-url` },
path: `/api/v1/blobs/${siteId}/deploy:${deployId}/my-key`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should we have a test with region included as well?

mrstork
mrstork previously approved these changes Apr 4, 2024
Copy link
Contributor

@mrstork mrstork left a comment

Choose a reason for hiding this comment

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

Some small and optional fixes, but overall looks good to me

mrstork
mrstork previously approved these changes Apr 10, 2024
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.

None yet

2 participants