withastro / adapters

Home for Astro's core maintained adapters
70 stars 42 forks source link

feat(vercel): single entrypoint #424

Closed ematipico closed 1 month ago

ematipico commented 1 month ago

Changes

Closes PLT-2550

This PR refactors the code of the Vercel adapter, and it now exports one single entry point for both static and serverless adapter.

The new code is inside index.ts. The code that differs between the new adapters is conditionally applied using if (buidOutput === "server") all over.

Also, I took the opportunity to make the creation of the config.json a bit more readable with a classic if/else, all those big ternaries were a bit hard to handle.

Testing

The current tests should pass.

I only updated one single test, where Astro was throwing an error for an incorrect configuration.

Docs

https://github.com/withastro/docs/pull/9755

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: dd0ada5ea84f7855a9854e5e0958da636612ebc5

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

This PR includes changesets to release 19 packages | Name | Type | | -------------------------------------------------------------- | ----- | | @astrojs/vercel | Minor | | @test/astro-vercel-basic | Patch | | @test/astro-vercel-image | Patch | | @test/vercel-isr | Patch | | @test/vercel-max-duration | Patch | | @test/vercel-edge-middleware-with-edge-file | Patch | | @test/vercel-edge-middleware-without-edge-file | Patch | | @test/astro-vercel-no-output | Patch | | @test/astro-vercel-prerendered-error-pages | Patch | | @test/astro-vercel-redirects-serverless | Patch | | @test/astro-vercel-redirects | Patch | | @test/vercel-server-islands | Patch | | @test/astro-vercel-serverless-prerender | Patch | | @test/astro-vercel-serverless-with-dynamic-routes | Patch | | @test/astro-vercel-static-assets | Patch | | @test/astro-vercel-static | Patch | | @test/vercel-streaming | Patch | | @test/astro-vercel-with-web-analytics-enabled-output-as-static | Patch | | vercel-hosted-astro-project | Patch |

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

florian-lefebvre commented 1 month ago

Does this require changes in astro add?

ematipico commented 1 month ago

Does this require changes in astro add?

Good call. Yes, it will. I will make a PR