Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DaneTheory/40ce4edb489a10eec6404fbffc3be39d to your computer and use it in GitHub Desktop.

Select an option

Save DaneTheory/40ce4edb489a10eec6404fbffc3be39d to your computer and use it in GitHub Desktop.
The Package (dot) JSON: A story of love, triumph, and general witchcraft/wizardry - InitFields: PeerDependencies
[{
"npm:current": {
"ref": "",
"source": [
]
},
"npm:legacy": {
"ref": "",
"source": [
]
},
"yarn:current": {
"ref": "https://yarnpkg.com/configuration/manifest#peerDependencies",
"source": [
"Peer dependencies are inherited dependencies - the consumer of your package will be tasked to provide them. This is typically what you want when writing plugins, for example. Note that peer dependencies can also be listed as regular dependencies; in this case, Yarn will use the package provided by the ancestors if possible, but will fallback to the regular dependencies otherwise.",
"_example_:{ \n \"peerDependencies\": { \n \"react\": \"*\", \n \"react-dom\": \"*\" \n } \n }:_example_"
]
},
"yarn:legacy": {
"ref": "https://classic.yarnpkg.com/en/docs/package-json/#toc-peerdependencies",
"source": [
"Peer dependencies allow you to state compatibility of your package with versions of other packages.",
"You can specify an exact version, a minimum version (e.g., '>=') or a range of versions (e.g. '>= ... <').",
"_example_:{ \n \"peerDependencies\": { \n \"package-3\": \"^2.7.18\" \n } \n }:_example_"
]
}
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment