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

Support deprecating Web Vitals table #11096

Merged
merged 3 commits into from
May 20, 2024
Merged

Conversation

delucis
Copy link
Member

@delucis delucis commented May 17, 2024

Changes

  • Adds an option to the web vitals integration that allows users to “deprecate” the Astro DB tables web vitals adds.
  • Currently, Astro DB requires a user to set deprecated: true on a table and push that before it will allow you to remove it completely. Because integrations control the tables themselves this is not something users can do themselves, so this PR reflects that up to the integration options.
  • See the README changes in this PR for a full description of the “uninstall” process. (It’s not amazing, might be something for us to be aware of/think about.)

Testing

Tested manually that the deprecated property is being set properly on the table config.

Docs

/cc @withastro/maintainers-docs for feedback on the README changes!

Copy link

changeset-bot bot commented May 17, 2024

🦋 Changeset detected

Latest commit: dedabbc

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label May 17, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I wish npm would allow some preunitinstall scripts, so libraries can clean after themselves. I suppose that's the best we can do for now.

@@ -2,7 +2,8 @@ import { defineDbIntegration } from '@astrojs/db/utils';
import { AstroError } from 'astro/errors';
import { WEB_VITALS_ENDPOINT_PATH } from './constants.js';

export default function webVitals() {
export default function webVitals({ deprecated }: { deprecated?: boolean } = {}) {
process.env.DEPRECATE_WEB_VITALS = deprecated ? 'true' : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we set this only when running a db push? Or is it intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess you might want it in dev etc. too? If you happened to run it while deprecated. Probably doesn’t matter either way though — I just wanted it to match how a user-defined table might behave really.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

README and changeset LGTM, Chris!

@delucis delucis merged commit 0dbd8ee into main May 20, 2024
13 checks passed
@delucis delucis deleted the chris/enable-removing-web-vitals branch May 20, 2024 14:51
@astrobot-houston astrobot-houston mentioned this pull request May 20, 2024
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.

None yet

4 participants