Skip to main content
1 of 8
apprenticeDev
  • 8.1k
  • 3
  • 25
  • 25

Grunt and Bower: package.json vs bower.json

I'm new to using npm and bower, building my first app in emberjs :).
I do have a bit of experience with rails, so I'm familiar with the idea of files for listing dependencies (such as bundler Gemfile)

So, question: when I want to add a package (and check in the dependency into git), where does it belong - into package.json or into bower.json?

From what I gather,
running bower install will fetch the package and put it in /vendor directory,
running npm install it will fetch it and put it into /node_modules directory.

this SO answer says bower is for front-end and npm is for backend stuff.
Ember-app-kit seems to adhere to this distinction from the first glance... But instructions in gruntfile for enabling some functionality give two explicit commands, so I'm totally confused here.

Intuitively I would guess that
npm install --save-dev package-name would be equivalent to adding the package-name to my package.json
Similarly, running
bower install --save package-name might be the same as adding the package to my bower.json and running bower install?

If that is the case, when should I ever install packages explicitly like that without adding them to the file that manages dependencies (apart from installing command line tools globally)?

Thanks in advance!

apprenticeDev
  • 8.1k
  • 3
  • 25
  • 25