Difference between Grunt, NPM 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)

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

  1. npm install –save-dev package-name would be equivalent to adding the package-name to my package.json

  2. 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)?

2 s
2

Leave a Comment