-
Notifications
You must be signed in to change notification settings - Fork 519
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
peerDependenciesMeta support #1228
Comments
Ahhhh awesome, thanks @filipesilva for finding this. For ref there's eample usage here: #1163 Our aim here is to not do anything more/less strict than npm/yarn, meaning that currently since they treat unsatisfied peer deps as warnings, we should also. With that in mind, I don't think we should be reading this field and acting on it ourselves, we should let yarn/npm do that logic for us. If there's some issue with the deps management then yarn/npm should be the ones to report it. |
Neither yarn, npm, nor pnpm treat them as warnings if the |
@filipesilva can you help me understand how this differs from #1163? @bweston92 do you understand this well enough to get on the standard solution? |
@alexeagle I don’t unfortunately |
Given these
If you install that library with either This issue requests that yarn_install and npm_install interpret the #1163 add a way to ignore a list of missing packages that are defined as peer dependencies. It does not interact with the |
We did something similar originally which added a new key
“ignoredDependencies” we can read the “peerDependenciesMeta” instead of
desired?
…On Tue, 8 Oct 2019 at 11:01, Filipe Silva ***@***.***> wrote:
Given these package.json entries on a library:
"peerDependencies": {
"node-sass": "^4.0.0"
},
"peerDependenciesMeta": {
"node-sass": {
"optional": true
}
},
If you install that library with either npm or yarn without also
installing node-sass, neither will emit an warning. The
peerDependenciesMeta key contains meta information about peer
dependencies, and the optional key set to true for a peer dependency
means that it is optional. Here are the tracking issues for yarn
<yarnpkg/yarn#6487> and npm
<npm/cli#224>.
This issue requests that yarn_install and npm_install interpret the
peerDependenciesMeta key correctly when present in packages and do not
error out when optional peer dependencies are missing.
#1163 <#1163> add a way to
ignore a list of missing packages that are defined as peer dependencies. It
does not interact with the peerDependenciesMeta key or its functionality.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1228>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANOVWPORBM7FYM7XEDF3I3QNRLA3ANCNFSM4I4WUESQ>
.
|
I'm not sure the usage pattern is the same. On your example for React with TypeScript peerdeps, you wouldn't be able to use |
Ahh sorry, yeah that leaves us with an issue of the package takes a while
too add it of at all.
I think we should just ignore peer dependencies in these rules personally.
…On Tue, 8 Oct 2019 at 12:06, Filipe Silva ***@***.***> wrote:
I'm not sure the usage pattern is the same. peerDependenciesMeta is a
property that library authors add, whereas ignoredDependencies seems to
be something consumers add.
On your example for React with TypeScript peerdeps, you wouldn't be able
to use peerDependenciesMeta. The libraries you depend on would have to
add it instead.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1228>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANOVWJQ3ZDWBMYOIS3TZBTQNRSUZANCNFSM4I4WUESQ>
.
|
For example asking |
Depends if https://unpkg.com/browse/[email protected]/util/convert-ast.js shows one such import. |
It's not used to make other package's peer dependencies optional but rather a package's own peer dependencies optional. There are now two types of peer dependencies a package can specify:
|
@filipesilva |
Sure, but that's It might be an argument towards yarn_install and npm_install not erroring out and instead showing a warning though. |
We just call |
Those optional peer dependencies could be deep in the dependency hierarchy and the end user may not even now they exist (or really should be required to know that they exist). Ideally, Bazel should ignore optional peer dependencies that are not present and continue to error for required peer dependencies that are not present. |
@alexeagle is there any progress in regard to this issue? I have experienced the same issue. Installing transitive dependencies helped but in long term, I can not image having to maintain in my |
latest release stops erroring about missing peerDeps. Still interested in what we need to do for peerDepsMeta field |
imo I think these rules shouldn't care too much about peer dependencies. At least until all the libraries have declared the In the case of |
okay so there is nothing more to do, it sounds like. We call the package manager and don't need to do anything but show the user what it says. |
🚀 feature request
Relevant Rules
yarn_install and npm_install
Description
A clear and concise description of the problem or missing capability...Both yarn and npm support the
peerDependenciesMeta
, which can make peer dependencies optional.Without it, packages like sass-loader will error out unless the optional peer dependencies are installed:
Describe the solution you'd like
If you have a solution in mind, please describe it.Describe alternatives you've considered
Ignoring the peer dependencies (#1162) might work too.
The text was updated successfully, but these errors were encountered: