gonzofish / angular-librarian

An Angular 2+ scaffolding setup for creating libraries
https://www.npmjs.com/package/angular-librarian
MIT License
91 stars 9 forks source link

Dependencies are always added as peer dependencies #85

Closed agasbzj closed 7 years ago

agasbzj commented 7 years ago

Thank you for your hard work to create such a greate build lib. I noticed that all the dependencies I added to "dependencies" in package.json file were all added in "peerDependencies" in the distribution package.json file. If I want to add dependencies in "dependencies", do I have to manually modify the built package.json file everytime or there is a option when adding dependencies as prod dependencies?

gonzofish commented 7 years ago

First, thank you for the kind words.

Yes you would, but I would advise against that. The reason we use peerDependencies is intentional. The end user of your library (even if its you) should be in charge of what versions of each library it packages. When you use dependencies you could end up with multiple versions of Angular if, for instance, your library specified 4.4.3 of @angular/compiler and another library specified 5.0.0

By using peerDependencies you provide the end user control over the dependencies and prevents duplication