Defining 'package' information in component.json and package.json

牧云@^-^@ 提交于 2019-12-23 09:07:40

问题


I'm creating a javascript library that I want make available through Bower to my internal company. I'm using Grunt to build my library.

My issue is that grunt's convention is to use package.json to define dependencies, library versions, dependencies, etc.

Bower, on the other hand, assumes that that same information is found in a component.json file.

What's the intended use of these two? They seem to serve essentially the same purpose. Do I need to create both and cut and paste the shared information?


回答1:


We've gotten a lot of these kinds of question and everyone assumes we could share a lot metadata between these formats, but the reality is that only the name and version fields are sharable and only the version field changes regularly. If you find it cumbersome having to update two fields when you release something, there are tools out there that can automate this, eg. grunt-bumpx.




回答2:


package.json is intended for back-end purposes, in this case specify grunt tasks, node dependencies, etc. In the other side, bower.json is intended for front-end purposes.



来源:https://stackoverflow.com/questions/16488329/defining-package-information-in-component-json-and-package-json

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!