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

patch: Mark @urql/core as a peer as well as a regular dependency #3579

Merged
merged 1 commit into from
May 3, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented May 2, 2024

Context

Originally (I reckon during the introduction of @urql/core), we decided to only include @urql/core as a dependency, since it never is a direct dependency. This allowed it to install automatically and deduplicate as long as all ranges match.

This wasn't ever a problem assuming deduplication was working (which it sometimes isn't in Yarn Legacy). However, @urql/core is only actively instantiated once in any given app. This means that for all exchanges it's only used to share types.

Problems with this is though, @urql/core's types contain instances that TypeScript will always consider as incompatible if they're duplicated. This means that this approach stopped working for TypeScript.

Summary

While we could provide shared global namespace types in @urql/core, which is my alternative proposal to solve this, we can also mark all dependencies on @urql/core as peer dependencies now.

Generally, peer dependencies install automatically with all package managers these days. But to keep backwards compatibility we can also keep @urql/core in dependencies at the same time. This should simply prompt package managers to always deduplicate it.

This PR also removes the >= range on it (although it's perfectly safe, this allows us to revamp some APIs in the next major of @urql/core), and updates the graphql peer dependency

Set of changes

  • Update prepare script
  • Update @urql/core dependencies to also be accompanied by a peer dependency
  • Update @urql/core ranges to ^5.0.0
  • Update graphql ranges to ^15.0.0 || ^16.0.0 || ^17.0.0 (dropping 0.x ranges for peers)
    • Not a breaking change, since the update is explicitly minor and support hasn't technically changed, so overriding this is safe

@kitten kitten requested a review from JoviDeCroock May 2, 2024 23:41
Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: 8cbd957

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

This PR includes changesets to release 14 packages
Name Type
@urql/exchange-request-policy Minor
@urql/introspection Minor
@urql/exchange-graphcache Minor
@urql/preact Minor
@urql/svelte Minor
@urql/exchange-persisted Minor
urql Minor
@urql/exchange-populate Minor
@urql/exchange-context Minor
@urql/exchange-execute Minor
@urql/exchange-refocus Minor
@urql/vue Minor
@urql/exchange-retry Minor
@urql/exchange-auth Minor

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

@JoviDeCroock JoviDeCroock merged commit 0204e04 into main May 3, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the fix/peer-dependency branch May 3, 2024 05:56
@github-actions github-actions bot mentioned this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants