7

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?

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
Roy Truelove
  • 22,016
  • 18
  • 111
  • 153

2 Answers2

5

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.

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
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.

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
kevinwolf
  • 274
  • 1
  • 12