Skip to content

Conversation

enesozturk
Copy link
Contributor

@enesozturk enesozturk commented Sep 16, 2025

Description

Here’s the PR description in plain Markdown, ready to copy:

PR: Switch viem (and related deps) to peerDependencies

Why

We previously declared viem (and in some cases wagmi) as a regular dependency in @reown/appkit, @reown/appkit-adapter-wagmi, and other internal packages.

This caused multiple versions of viem to be installed in consuming apps whenever users had their own viem in package.json.

Example problem case

User installs:

  pnpm add wagmi wagmi/connectors [email protected]

Our packages declare:

"dependencies": { "viem": "^0.3.0" }

Result: node_modules ends up with two different versions of viem (user’s 0.2.0 and our 0.3.x).
This breaks consumers because viem types and runtime are not compatible across multiple copies.

How

We now declare viem (and wagmi where imported directly) as peer dependencies:

"peerDependencies": {
  "viem": ">=xyz",
  "wagmi": ">=abc"
}
  • peerDependencies: tell the app to provide these packages.
  • Removed dependencies entries for viem and wagmi.

Benefits

  • Single version of viem: Consumers control which version is installed, ensuring all packages share the same copy.
  • Compatibility: Consumers can align wagmi + viem versions without fighting our pinned deps.
  • Less duplication: Smaller node_modules, less chance of type mismatches.

Example dependency tree

Before
app
 ├─ wagmi
 ├─ [email protected]
 ├─ @reown/appkit
 │   └─ [email protected]   <-- duplicate
 └─ @reown/appkit-adapter-wagmi
     └─ [email protected]   <-- duplicate
After
app
 ├─ wagmi
 ├─ [email protected]   <-- single copy, shared
 ├─ @reown/appkit (peer -> uses app’s viem)
 └─ @reown/appkit-adapter-wagmi (peer -> uses app’s viem)

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-xxx
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

@Copilot Copilot AI review requested due to automatic review settings September 16, 2025 17:29
Copy link

changeset-bot bot commented Sep 16, 2025

⚠️ No Changeset found

Latest commit: 82cccd5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Sep 17, 2025 0:28am
appkit-demo Ready Ready Preview Comment Sep 17, 2025 0:28am
appkit-gallery Ready Ready Preview Sep 17, 2025 0:28am
appkit-laboratory Error Error Sep 17, 2025 0:28am
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Sep 17, 2025 0:28am
appkit-basic-sign-client-example Ignored Ignored Sep 17, 2025 0:28am
appkit-basic-up-example Ignored Ignored Sep 17, 2025 0:28am
appkit-ethers5-bera Ignored Ignored Sep 17, 2025 0:28am
appkit-nansen-demo Ignored Ignored Sep 17, 2025 0:28am
appkit-vue-solana Ignored Ignored Sep 17, 2025 0:28am
appkit-wagmi-cdn-example Ignored Ignored Sep 17, 2025 0:28am
ethereum-provider-wagmi-example Ignored Ignored Sep 17, 2025 0:28am
next-wagmi-solana-bitcoin-example Ignored Ignored Sep 17, 2025 0:28am
vue-wagmi-example Ignored Ignored Sep 17, 2025 0:28am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the viem dependency from dependencies to optionalDependencies across multiple packages in the codebase, making it an optional rather than required dependency for consumers.

Key changes:

  • Removes viem from the dependencies section in all affected package.json files
  • Adds viem to optionalDependencies with version constraint >=2.37.2
  • In the wagmi adapter, moves viem from peerDependencies to optionalDependencies

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/siwx/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/siwe/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/experimental/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/controllers/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/common/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/cdn/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/appkit/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/appkit-utils/package.json Moves viem to optionalDependencies, incorrectly adds wagmi instead
packages/adapters/wagmi/package.json Correctly moves viem from peerDependencies to optionalDependencies
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented Sep 16, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.47% 35811 / 45633
🔵 Statements 78.47% 35811 / 45633
🔵 Functions 76.33% 3936 / 5156
🔵 Branches 86.52% 8511 / 9837
File CoverageNo changed files found.
Generated in workflow #15175 for commit 82cccd5 by the Vitest Coverage Report Action

@enesozturk enesozturk changed the title chore: move viem to optionalDependencies chore: move viem to peerDependencies Sep 17, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

Fails
🚫 Loose dependency versions in packages/adapters/wagmi/package.json, please use strict versioning
🚫 Loose dependency versions in packages/appkit-utils/package.json, please use strict versioning
🚫 Loose dependency versions in packages/appkit/package.json, please use strict versioning
🚫 Loose dependency versions in packages/common/package.json, please use strict versioning
🚫 Loose dependency versions in packages/controllers/package.json, please use strict versioning
🚫 Loose dependency versions in packages/experimental/package.json, please use strict versioning
🚫 Loose dependency versions in packages/siwe/package.json, please use strict versioning
🚫 Loose dependency versions in packages/siwx/package.json, please use strict versioning

Generated by 🚫 dangerJS against 82cccd5

@enesozturk enesozturk changed the title chore: move viem to peerDependencies chore: use caret version for the viem dependencies Sep 18, 2025
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.

1 participant