Reputation: 23257
Trying to figure out what peerDependencies
stands for... I came up with this package.json
content file. It belongs to a library project which is distributed over there.
{
"name": "...",
"version": "...",
"description": "...",
"author": "...",
"license": "Unlicense",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "typings install && tsc --outDir dist/"
},
"peerDependencies": {
"@angular/core": "^2.0.0", <<<<<<<<
"@angular/http": "^2.0.0", <<<<<<<<
"@angular/common": "^2.0.0", <<<<<<<<
"@angular/compiler": "^2.0.0", <<<<<<<<
"core-js": "^2.4.0", <<<<<<<<
"reflect-metadata": "^0.1.3", <<<<<<<<
"rxjs": "5.0.0-beta.12", <<<<<<<<
"zone.js": "^0.6.17" <<<<<<<<
},
"devDependencies": {
"@angular/core": "^2.0.0", <<<<<<<<
"@angular/http": "^2.0.0", <<<<<<<<
"@angular/common": "^2.0.0", <<<<<<<<
"@angular/compiler": "^2.0.0",
"@angular/platform-browser": "^2.0.0", <<<<<<<<
"core-js": "^2.4.0", <<<<<<<<
"reflect-metadata": "^0.1.3", <<<<<<<<
"rxjs": "5.0.0-beta.12", <<<<<<<<
"zone.js": "^0.6.17", <<<<<<<<
"typescript": "^2.0.0",
"typings": "^1.3.2"
}
}
devDependencies
and on peerDependencies
?dependencies
is not used?Upvotes: 0
Views: 245
Reputation: 29834
Since npm 3, peerDependencies
are not automatically downloaded anymore. Instead nom will warn if a dependency is not already installed.
The reason for structuring a package.json
this way that I would imagine is:
developers of this package need to download and install the dependencies and use the list in devDependencies
consumers of this package do not necessarily need to download the dependencies as they may already have them installed in their project. However, if they do not already have them, the presence of peerDependencies
will guarantee they will get a warning on install (which they will need to resolve manually).
Upvotes: 1