-
Notifications
You must be signed in to change notification settings - Fork 2
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
peerDependencies are not handled correctly #9
Comments
PNPM will also not throw errors when peer depenencies are not forwarded up the dep tree https://github.com/ling1726/pnpm-peer-deps FYI @sjwilczynski |
pnpm treats peers as regular dependencies from my understanding... So, here's how I think I view things... Midgard Yarn Strict definitely is the most strict of all the above package managers, for better or worse. If you look at the above image, I think the issue MYS has is that... An app takes a dependency on
Ok, cool so far, but
However, What MYS sees as the solution here is to forward them as That's just how the current MYS algorithm views the world. We've investigated the idea of changing the algorithm a bit to look and see if any parent has correctly implemented the peers, and allowing them to point to the parent, but haven't gotten around to a very performant way to do that. I'd very much love to have an open dialog and conversation around this as this is definitely a pain point for us too. :) |
And this has perfect sense 🐱 To clarify,
I would like to see an example there 🐱 In meantime, I can share some expectations on how it could work ⬇️ Let's use flowchart LR
TOKENS("`@fluentui/tokens
_peerDependencies: {}_
`")
THEME("`@fluentui/react-theme
_peerDependencies: {}_
`")
MENU("`@fluentui/react-menu
peerDependencies: {'react', 'react-dom'}
`")
SELECTOR("`@fluentui/react-context-selector
peerDependencies: {'react', 'react-dom', 'scheduler'}
`")
COMPONENTS("`@fluentui/react-components`")
classDef align text-align:left
TOKENS:::align --> THEME:::align --> MENU:::align
SELECTOR:::align --> MENU
MENU --> COMPONENTS
COMPONENTS --> APP[app-pkg]
The branch with The base principle:
The example:
|
Hello there 👋
Recently in Fluent UI we noticed that there are complains about
peerDependencies
that we never noticed before (microsoft/fluentui#23697, microsoft/fluentui#23681, microsoft/fluentui#23639).I created a small reproduction case (https://github.com/layershifter/midgard-yarn-problem) and indeed there are warnings about
peerDependencies
:This is extremely strange as
pkg-test
declared in a workspace has all required dependencies declared:Yarn v1, Yarn v3 & NPM do not emit any warnings at this moment. But they will if
react
,react-dom
,scheduler
or any other peer dependency will not be declared inpkg-test/package.json
(regardless of where it is in the dependency tree):I also tried to trace
scheduler
and it's declared aspeerDependency
of@fluentui/[email protected]
:https://github.com/microsoft/fluentui/blob/a569864246be0184a5a51421b3da4450deafb854/packages/react-components/react-context-selector/package.json#L38
The fix that was made to remove this warning - add
scheduler
aspeerDependency
to all packages in a dependency tree (microsoft/fluentui#23681):@fluentui/react-context-selector
->@fluentui/react-popover
->@fluentui/react-components
. That does not seem correct to me. I would expect thatpkg-test
(a package from the example) will fail ifscheduler
is not listed independencies
/devDependencies
/peerDependencies
, but not for errors in a tree (i.e.node_modules
).For example, if an application
@fluentui/react-components
which uses@fluentui/react-context-selector
we should have an error about unmeet peer dependency (if an application not listing scheduler as a dependency or devDependency). However, we should not see an error about@fluentui/react-components
not listingscheduler
- an application is not responsible for enforcing strictness in downstream repos.Currently it's unclear why should a package be responsible for forwarding its
peerDependencies
🙃The text was updated successfully, but these errors were encountered: