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

fix: Switch dependencies to depend on @chakra-ui/react instead of sub-packages #336

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

csandman
Copy link
Owner

@csandman csandman commented Oct 9, 2024

This PR fixes #335 by removing the peer dependencies on the sub-packages of @chakra-ui/react and switches to depend on the full package. This is something I've been meaning to do for a while, and already made the change for my upcoming v5 release (#323), as the peer sub-packages have been frustrating to people.

As of @chakra-ui/[email protected], this now becomes a required change due to their switching to a single package approach, because the peer dependencies of the individual sub-dependencies are no longer installed at the top level: chakra-ui/chakra-ui#8153

Here are some notes one why I wanted to make this change before this breaking change anyway from #323:


There has been a lot of back and forth on whether this package should use @chakra-ui/react as it's peer dependency, or just the individual sub-packages it relies on. Originally, it just used the root package as it's peer dependency, but after a suggestion, that was swapped out with the individual packages: #56

However, since then there have been a lot of complaints (mostly by people who use yarn as their package manager) about not having all of the included peer dependencies in their package.json:

Ultimately, I've realized that for most people, having @chakra-ui/react as the actual peer dependency works best for the majority of users, including myself, as most people are using the package in it's entirety as a dependency, instead of the sub-packages.

However, all of the imports are still being pulled in from the sub-packages. I'm not sure if this is the ideal approach, but it's possible this will still allow those who only have the sub-packages installed to use this component if they ignore the peer dependency.


In addition to this, I updated all of the other dependencies of this package:

 @arethetypeswrong/cli              ^0.15.4  →   ^0.16.4
 @emotion/react                    ^11.11.4  →  ^11.13.3
 @emotion/styled                   ^11.11.5  →  ^11.13.0
 @types/react                       ^18.3.3  →  ^18.3.11
 concurrently                        ^8.2.2  →    ^9.0.1
 eslint-plugin-import               ^2.29.1  →   ^2.31.0
 eslint-plugin-jsx-a11y              ^6.9.0  →   ^6.10.0
 eslint-plugin-react                ^7.34.3  →   ^7.37.1
 husky                              ^9.0.11  →    ^9.1.6
 lint-staged                        ^15.2.7  →  ^15.2.10
 nodemon                             ^3.1.4  →    ^3.1.7
 prettier                            ^3.3.2  →    ^3.3.3
 react-select                         5.8.0  →     5.8.1
 tsup                                ^8.1.0  →    ^8.3.0
 typescript                          ^5.5.2  →    ^5.6.3

as well as switched to a newer tsconfig.json setup based on the tsconfig from @chakra-ui/react: https://github.com/chakra-ui/chakra-ui/blob/main/tsconfig.build.json

Copy link

codesandbox-ci bot commented Oct 9, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

github-actions bot commented Oct 9, 2024

📊 Package size report   -4.22%↓

File Before After
dist/index.d.mts 21.1 kB -0%↓21.1 kB
dist/index.d.ts 21.1 kB -0%↓21.1 kB
dist/index.js 16.7 kB -1.36%↓16.5 kB
dist/index.js.map 79.5 kB -6.95%↓74.0 kB
dist/index.mjs 15.3 kB -1.45%↓15.1 kB
dist/index.mjs.map 79.5 kB -6.98%↓73.9 kB
package.json 3.4 kB -13.8%↓3.0 kB
Total (Includes all files) 284.2 kB -4.22%↓272.2 kB
Tarball size 63.7 kB -4.34%↓60.9 kB
Unchanged files
File Size
LICENSE.md 1.1 kB
README.md 46.3 kB

🤖 This report was automatically generated by pkg-size-action

@csandman csandman merged commit 12d7cc6 into main Oct 9, 2024
4 checks passed
@csandman csandman deleted the fix/switch-to-chakra-ui-react-imports branch October 9, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants