-
Notifications
You must be signed in to change notification settings - Fork 1k
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(deps) resolve yarn warnings regarding unmet peer dependencies for Redwood projects #8874
Conversation
@jtoar any chance to get this in given that you agree with me there's no need to create a codemod here:
What say you? |
@Tobbe can we target this one for v7? It's a nice DX + quality of life change. Already documented for Upgrade Guide. Happy to handle conflicts. Just let me know. |
@thedavidprice I agree. Looks like a really nice DX improvement. Dom had some reservations about exactly how it was implemented. He'll review and get back to us with comments. |
Important A lot of these can be fixed by just adding the missing dependency. Since we enforce that all our packages depend on the same version of a dependency, as long as one of our packages already depends on the missing dependency, "adding" a dependency to a package doesn't incur an increase in size. I'd like to try to fix the warnings instead of silencing them. I understand that some of them aren't our packages and will have to be fixed upstream, in which case silencing may be the answer. But most of them are ours. Here's the errors we get (on CRWA install):
From top to bottom:
|
Here's an instance of where those warnings tripped up one of our users: #9760 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging this one. I scaled back my changes after yarn 4. Yarn 4 drastically reduces the number of peer dependency warnings it console out of the box. From the blog post:
You will also notice it doesn't print as much warnings around peer dependencies, as we now try to only print warnings for actionable situations.
Here's the dependency warnings yarn v4 prints:
$ yarn
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0060: │ react is listed by your project with version 18.2.0, which doesn't satisfy what @redwoodjs/router (p1eae0) and other dependencies request (but they have non-overlapping ranges!).
➤ YN0060: │ react-dom is listed by your project with version 18.2.0, which doesn't satisfy what @redwoodjs/router (p62015) and other dependencies request (but they have non-overlapping ranges!).
➤ YN0002: │ web@workspace:web doesn't provide graphql (p0b33c), requested by @redwoodjs/forms.
➤ YN0086: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 397ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 348ms
➤ YN0000: · Done with warnings in 0s 948ms
There's only three now. David's original changes address the react ones, and the change I made to forms gets rid of the third.
Just so that I don't get misinterpreted, this doesn't mean that everything is fixed. (Things weren't necessarily broken either, Yarn was just doing it's job.) I just want this PR to get merged because what it has is already a big win, and I've let the scope creep too much before when I tried doing too much.
… Redwood projects (#8874) Running `yarn install` in a Redwood project results in a wall of information, most of which are warnings about peer dependencies and unmet dependency version requirements. We (framework authors) put up with it but that's not the case for developers — best case they find the output warnings annoying (and hopefully don't miss important errors); worst case it turns people away from using Redwood. Some, but not all, warnings are from Redwood packages. Many are upstream. At this time, there is no known negative impact from these dependency warnings — i.e. ideally they would all be resolved, but doing so has diminishing returns and is an ongoing maintenance consideration. This PR silences warnings that are considered acceptable and resolves those that are not. (Note: contributions are welcome for anyone who'd like to completely resolve these warnings!) Lastly, warnings != errors. This PR does not touch errors (if/when applicable). Here's what `yarn install` will look like with changes from this PR ![yarn-install](https://github.com/redwoodjs/redwood/assets/2951/278d2f36-a5e8-430d-8179-f6a8899d3227) Nice, right?!? 🤯 There are two cases of warnings handled by this PR. Case 1) [YN0002 - MISSING_PEER_DEPENDENCY](https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency) This PR silences these warnings using yarnrc `logFilters`. Important: devs can still inspect these warnings via `yarn explain peer-requirements` or by managing their projects' `logFilters` config. Case 2) [YN0060 - INCOMPATIBLE_PEER_DEPENDENCY](https://yarnpkg.com/advanced/error-codes#yn0060---incompatible_peer_dependency) Because this can only be resolved via the parent package, this PR moves the necessary package code into the respective Redwood Package, thus properly fixing the incompatibility. This PR breaks a CSS import in the a11y Template `layout.tsx.a11yTemplate`, which is used when anyone generates a layout component with the `--skipLink` command option: `yarn redwood generate layout <name> --skipLink` ```diff // web/src/layouts/MyLayout/MyLayout.{jsx|tsx} import { SkipNavLink, SkipNavContent } from '@redwoodjs/router' -import '@reach/skip-nav/styles.css' +import '@redwoodjs/router/skip-nav.css' ``` - [x] Update redwoodjs/docs/a11y - [ ] Codemode for layout component import change (might not be necessary as find+replace would work just fine) --------- Co-authored-by: Dominic Saadi <[email protected]>
Running
yarn install
in a Redwood project results in a wall of information, most of which are warnings about peer dependencies and unmet dependency version requirements. We (framework authors) put up with it but that's not the case for developers — best case they find the output warnings annoying (and hopefully don't miss important errors); worst case it turns people away from using Redwood.Some, but not all, warnings are from Redwood packages. Many are upstream. At this time, there is no known negative impact from these dependency warnings — i.e. ideally they would all be resolved, but doing so has diminishing returns and is an ongoing maintenance consideration. This PR silences warnings that are considered acceptable and resolves those that are not. (Note: contributions are welcome for anyone who'd like to completely resolve these warnings!)
Lastly, warnings != errors. This PR does not touch errors (if/when applicable).
Resulting Output
Here's what
yarn install
will look like with changes from this PRNice, right?!? 🤯
Handling existing peer dep warnings
There are two cases of warnings handled by this PR.
Case 1) YN0002 - MISSING_PEER_DEPENDENCY
This PR silences these warnings using yarnrc
logFilters
.Important: devs can still inspect these warnings via
yarn explain peer-requirements
or by managing their projects'logFilters
config.Case 2) YN0060 - INCOMPATIBLE_PEER_DEPENDENCY
Because this can only be resolved via the parent package, this PR moves the necessary package code into the respective Redwood Package, thus properly fixing the incompatibility.
Breaking
This PR breaks a CSS import in the a11y Template
layout.tsx.a11yTemplate
, which is used when anyone generates a layout component with the--skipLink
command option:yarn redwood generate layout <name> --skipLink
ToDo