chore: moving dependencies to peer and dev dependencies#729
Conversation
📖 Storybook Preview |
| "autoprefixer": "^10.4.20", | ||
| "axe-playwright": "^2.1.0", | ||
| "bitcoin-address-validation": "^3.0.0", | ||
| "playwright": "^1.52.0", |
There was a problem hiding this comment.
These dependencies have been moved to peerDependencies in design-system-react, so they now need to be explicitly added as devDependencies in storybook-react
| "react-native-gesture-handler": "^1.10.3", | ||
| "react-native-jazzicon": "^0.1.2", | ||
| "react-native-reanimated": "3.3.0" | ||
| "react-native-jazzicon": "^0.1.2" |
There was a problem hiding this comment.
We are keeping react-native-jazzicon as a regular dependency because it should only be used internally by AccountAvatar within design-system-react-native, not directly by consuming applications.
| "@metamask/utils": "^11.4.0", | ||
| "@radix-ui/react-slot": "^1.1.0", | ||
| "@solana/addresses": "^2.1.0", | ||
| "bitcoin-address-validation": "^3.0.0", |
There was a problem hiding this comment.
These dependencies have been moved to peerDependencies because they are used by the extension and portfolio outside of the design system’s UI components, so moving them to peerDependencies allows the consuming app to specify the version, reducing the overall bundle size and avoiding duplicate dependencies. We are keeping @metamask/jazzicon as a regular dependency because it should only be used internally by AccountAvatar within design-system-react, not directly by consuming applications.
| "deepmerge": "^4.2.2", | ||
| "jest": "^29.7.0", | ||
| "metro-react-native-babel-preset": "^0.77.0", | ||
| "react": "^18.2.0", |
There was a problem hiding this comment.
Fixing build issue by moving react to devDependencies, not actually sure how it passed CI without it being here 🤔
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
0a959b0 to
0317b81
Compare
📖 Storybook Preview |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
0317b81 to
9f52125
Compare
📖 Storybook Preview |
| "@metamask/design-tokens": "^7.0.0", | ||
| "@metamask/utils": "^11.0.0", | ||
| "@solana/addresses": "^2.0.0", | ||
| "bitcoin-address-validation": "2.0.0", |
There was a problem hiding this comment.
Previously tried 2|3 as the only update is to convert to esm modules but are restricted because of yarn constraints. We can just fast follow an upgrade when extension and mobile do https://github.com/ruigomeseu/bitcoin-address-validation/blob/master/CHANGELOG.md
b762d7a to
ff8ed96
Compare
📖 Storybook Preview |
|
@metamaskbot publish-preview |
| "@metamask/utils": "^11.0.0", | ||
| "@solana/addresses": "^2.0.0", | ||
| "bitcoin-address-validation": "2.0.0", |
There was a problem hiding this comment.
These dependencies have been moved to peerDependencies in design-system-react-native, so they now need to be explicitly added as dependencies in storybook-react-native
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
| "@metamask/eslint-config-nodejs": "^14.0.0", | ||
| "@metamask/eslint-config-typescript": "^14.0.0", | ||
| "@metamask/utils": "^11.4.0", | ||
| "@metamask/utils": "^11.0.0", |
There was a problem hiding this comment.
yarn constraints update
| "bitcoin-address-validation": "^3.0.0", | ||
| "react-native-gesture-handler": "^1.10.3", | ||
| "react-native-jazzicon": "^0.1.2", | ||
| "react-native-reanimated": "3.3.0" |
There was a problem hiding this comment.
These dependencies have been moved to either peerDependencies or devDependencies based on their usage. Packages like testing-library are only needed for development and testing, so they are now devDependencies. The other packages are used by mobile outside of the design system’s UI components, so moving them to peerDependencies allows the consuming app to specify the version, reducing the overall bundle size and avoiding duplicate dependencies.
| "@metamask/auto-changelog": "^5.0.2", | ||
| "@metamask/design-system-twrnc-preset": "workspace:^", | ||
| "@metamask/design-tokens": "workspace:^", | ||
| "@metamask/utils": "^11.0.0", |
There was a problem hiding this comment.
We are pinning @metamask/utils to major version ^11.0.0 to maintain compatibility with MetaMask Mobile, which uses ^11.2.0 (see metamask-mobile/package.json#L246). Any 11.x version will work across both projects.
| "@metamask/design-system-twrnc-preset": "workspace:^", | ||
| "@metamask/design-tokens": "workspace:^", | ||
| "@metamask/utils": "^11.0.0", | ||
| "@solana/addresses": "^2.0.0", |
There was a problem hiding this comment.
We are pinning @solana/addresses to major version ^2.0.0 to maintain compatibility with MetaMask Mobile, which uses 2.0.0 (see metamask-mobile/package.json#L280).
| "@types/react": "^18.2.0", | ||
| "@types/react-test-renderer": "^18", | ||
| "babel-jest": "^29.7.0", | ||
| "bitcoin-address-validation": "2.0.0", |
There was a problem hiding this comment.
We are pinning bitcoin-address-validation to major version ^2.0.0 to maintain compatibility with MetaMask Mobile, which uses 2.0.0 (see metamask-mobile/package.json#L295).
📖 Storybook Preview |
|
@metamaskbot publish-preview |
| "@metamask/utils": "^11.0.0", | ||
| "@solana/addresses": "^2.0.0", | ||
| "bitcoin-address-validation": ">=2.0.0", |
There was a problem hiding this comment.
These dependencies have been moved to peerDependencies in design-system-react-native, so they now need to be explicitly added as devDependencies in storybook-react-native
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
| "@types/react": "^18.2.0", | ||
| "@types/react-test-renderer": "^18", | ||
| "babel-jest": "^29.7.0", | ||
| "bitcoin-address-validation": ">=2.0.0", |
There was a problem hiding this comment.
We specify bitcoin-address-validation with the version constraint >=2.0.0 to ensure compatibility with MetaMask Mobile, which currently uses version 2.0.0 (reference). This range also permits upgrades to future major versions, including 3.x.x, since both v2 and v3 are compatible with design system libraries. Notably, v3.0.0 introduces ESM (ECMAScript Modules) support, which this project fully supports, as reflected in the CHANGELOG.
| "metro-react-native-babel-preset": "^0.77.0", | ||
| "react": "^18.2.0", | ||
| "react-native": "^0.72.15", | ||
| "react-native-gesture-handler": "^1.10.3", |
There was a problem hiding this comment.
Aligns with mobile https://github.com/MetaMask/metamask-mobile/blob/main/package.json#L295
| "expo-system-ui": "~2.4.0", | ||
| "react-native-gesture-handler": "^1.10.3", | ||
| "react-native-reanimated": "3.3.0", | ||
| "react-native-reanimated": "^3.17.2", |
There was a problem hiding this comment.
Aligning react-native-reanimated version with mobile https://github.com/MetaMask/metamask-mobile/blob/main/package.json#L389
| "react": "^18.2.0", | ||
| "react-native": "^0.72.15", | ||
| "react-native-gesture-handler": "^1.10.3", | ||
| "react-native-reanimated": "^3.17.2", |
There was a problem hiding this comment.
Aligning react-native-reanimated with mobile https://github.com/MetaMask/metamask-mobile/blob/main/package.json#L389
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
📖 Storybook Preview |
| * @returns True if the address is valid, false otherwise | ||
| */ | ||
| export function validate(address: string, network?: Network): boolean; | ||
| } |
There was a problem hiding this comment.
Needed because we downgraded our version of bitcoin-address-validation to match mobile
| * @returns True if the address is valid, false otherwise | ||
| */ | ||
| export function validate(address: string, network?: Network): boolean; | ||
| } |
There was a problem hiding this comment.
Needed because we downgraded our version of bitcoin-address-validation to match extension can be removed when we upgrade to v3
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
📖 Storybook Preview |
| "@metamask/design-system-twrnc-preset": "^0.0.0", | ||
| "@metamask/design-tokens": "^7.0.0", | ||
| "@metamask/utils": "^11.0.0", | ||
| "@solana/addresses": "^2.0.0", | ||
| "bitcoin-address-validation": ">=2.0.0", | ||
| "react": ">=18.2.0", | ||
| "react-native": ">=0.72.0" | ||
| "react-native": ">=0.72.0", | ||
| "react-native-gesture-handler": ">=1.10.3", | ||
| "react-native-reanimated": ">=3.3.0" |
There was a problem hiding this comment.
Broadened peer dependency version ranges to support major upgrades for react-native, react-native-gesture-handler, and react-native-reanimated, enabling forward compatibility. Other key dependencies have been explicitly versioned to ensure stability and prevent breaking changes.
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Description
This PR aligns dependency versions across the design system with MetaMask extension and mobile codebases to ensure compatibility
Key changes:
^3.0.0to>=2.0.0to avoid ESM-only modules that break compatibility with browser extensions and React Native@metamask/utils:^11.4.0→^11.0.0@solana/addresses:^2.1.0→^2.0.0devDependenciesandpeerDependencieswhere appropriateThe
>=2.0.0version range for bitcoin-address-validation allows v2.x.x, v3.x.x, and future versions while maintaining compatibility with CommonJS environments used by MetaMask extension and mobile.Related issues
Fixes: #690
Manual testing steps
yarn constraints --fix- should pass without violationsyarn build- all packages should build successfullyyarn lint- should pass with only expected warningsText published preview packages in mobile PR
Screenshots/Recordings
Before
After
Latest publish preview (8a24c64) working in mobile and extension
after.mov
after.extension.mov
Pre-merge author checklist
Pre-merge reviewer checklist