Skip to content

Add the output option#4015

Merged
FredKSchott merged 22 commits into
mainfrom
new-adapter-api-2
Jul 25, 2022
Merged

Add the output option#4015
FredKSchott merged 22 commits into
mainfrom
new-adapter-api-2

Conversation

@matthewp

@matthewp matthewp commented Jul 21, 2022

Copy link
Copy Markdown
Contributor

Changes

  • Adds the new config option output: 'static' | 'server'
  • This opens up the ability for Adapters to add special support for static mode.
  • This API is used instead of the presence of an adapter to enable SSR features.
  • If an adapter is omitted and output === 'server' we through an error during build.

Testing

  • Tests added

Docs

@changeset-bot

changeset-bot Bot commented Jul 21, 2022

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3d179ab

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

This PR includes changesets to release 19 packages
Name Type
astro Minor
@astrojs/cloudflare Minor
@astrojs/deno Minor
@astrojs/image Minor
@astrojs/netlify Minor
@astrojs/node Minor
@astrojs/sitemap Minor
@astrojs/vercel Minor
@e2e/astro-component Patch
@e2e/error-react-spectrum Patch
@e2e/error-sass Patch
@e2e/errors Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/svelte-component Patch
@e2e/e2e-tailwindcss Patch
@e2e/ts-resolution 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

@github-actions github-actions Bot added pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) labels Jul 21, 2022
@natemoo-re natemoo-re mentioned this pull request Jul 21, 2022
20 tasks

@FredKSchott FredKSchott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM so far!

force people to rename adapter to deploy or stay back-compat with adapter and a deprecation notice?

I'd lean for back-compat + deprecation notice. It's cheap to do a config rename like that inside of validateConfig() iirc.

Comment thread examples/basics/astro.config.mjs Outdated
Comment thread examples/basics/astro.config.mjs Outdated
Comment thread .changeset/lucky-apes-yell.md Outdated
Comment thread packages/astro/src/@types/astro.ts Outdated
Comment thread packages/astro/src/core/build/index.ts Outdated
Comment thread packages/astro/src/core/build/page-data.ts
Comment thread packages/astro/src/core/logger/node.ts Outdated
@matthewp

matthewp commented Jul 22, 2022

Copy link
Copy Markdown
Contributor Author

TODO:

  • - Update adapters to throw when attempted to use with mode: 'static'.

@matthewp matthewp force-pushed the new-adapter-api-2 branch from 4acd885 to fa48c4e Compare July 22, 2022 15:19
@matthewp matthewp marked this pull request as ready for review July 22, 2022 16:05
@matthewp matthewp self-assigned this Jul 22, 2022

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking this PR. There is an ongoing discussion on Discord about overloading the name mode which is a well-defined Vite-ism.

As soon as that's resolved, I'm totally on board with the core changes here.

@matthewp matthewp changed the title Add the mode option Add the output option Jul 22, 2022
@matthewp matthewp force-pushed the new-adapter-api-2 branch from 1e97fdf to a5ffe45 Compare July 22, 2022 19:46
Comment thread .changeset/famous-coins-destroy.md Outdated
'@astrojs/vercel': minor
---

New `mode` configuration option

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changeset needs to be updated to refer to output

@FredKSchott FredKSchott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for helping to get this over the line @matthewp. I took a quick pass to clean this up for you so that we can merge in time for the RC. Here's a summary of the changes made on top of your PR:

  • cleaned up some of the auto-doc generation types.
  • cleaned up some of the old code from my original PR that had made its way into this one (old changesets, old "exports' entry, etc)
  • Kept the config output and the term "output target"/"output mode" used to describe it.
  • Reverted the deploy change to keep it as adapter for now. I'm glad that we experimented with a new name here but after trying a few out first-hand I wasn't happy with anything to the point that it would be worth the switch and increased migration cost of the more important output change. Let's keep it as "adapter" for now and can revisit later if user feedback is that the word "adapter" is still too vague.

@FredKSchott FredKSchott merged commit 6fd161d into main Jul 25, 2022
@FredKSchott FredKSchott deleted the new-adapter-api-2 branch July 25, 2022 04:18
@astrobot-houston astrobot-houston mentioned this pull request Jul 25, 2022
ematipico pushed a commit that referenced this pull request Feb 5, 2025
* Start of work on astroConfig.mode === 'server'

* Add tests and more

* adapter -> deploy in some places

* Add fallback for `adapter` config

* Update more tests

* Update image tests

* Fix clientAddress test

* Updates based on PR review

* Add a changeset

* Update integrations tests + readme

* Oops

* Remove old option

* Rename `mode` to `output`

* Update Node adapter test

* Update test

* fred pass

* fred pass

* fred pass

* fix test

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
ematipico pushed a commit that referenced this pull request Feb 5, 2025
* Start of work on astroConfig.mode === 'server'

* Add tests and more

* adapter -> deploy in some places

* Add fallback for `adapter` config

* Update more tests

* Update image tests

* Fix clientAddress test

* Updates based on PR review

* Add a changeset

* Update integrations tests + readme

* Oops

* Remove old option

* Rename `mode` to `output`

* Update Node adapter test

* Update test

* fred pass

* fred pass

* fred pass

* fix test

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
ematipico pushed a commit that referenced this pull request Feb 6, 2025
* Start of work on astroConfig.mode === 'server'

* Add tests and more

* adapter -> deploy in some places

* Add fallback for `adapter` config

* Update more tests

* Update image tests

* Fix clientAddress test

* Updates based on PR review

* Add a changeset

* Update integrations tests + readme

* Oops

* Remove old option

* Rename `mode` to `output`

* Update Node adapter test

* Update test

* fred pass

* fred pass

* fred pass

* fix test

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
ematipico pushed a commit that referenced this pull request Feb 6, 2025
* Start of work on astroConfig.mode === 'server'

* Add tests and more

* adapter -> deploy in some places

* Add fallback for `adapter` config

* Update more tests

* Update image tests

* Fix clientAddress test

* Updates based on PR review

* Add a changeset

* Update integrations tests + readme

* Oops

* Remove old option

* Rename `mode` to `output`

* Update Node adapter test

* Update test

* fred pass

* fred pass

* fred pass

* fix test

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
ematipico pushed a commit that referenced this pull request Feb 7, 2025
* Start of work on astroConfig.mode === 'server'

* Add tests and more

* adapter -> deploy in some places

* Add fallback for `adapter` config

* Update more tests

* Update image tests

* Fix clientAddress test

* Updates based on PR review

* Add a changeset

* Update integrations tests + readme

* Oops

* Remove old option

* Rename `mode` to `output`

* Update Node adapter test

* Update test

* fred pass

* fred pass

* fred pass

* fix test

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants