Return config as object

I factored out buildConfig from index.js, and added logic to pass the generated config as a parameter to the callback.

This should make it possible to more easily use this library from other systems. 

For example, in a gulp file it can be useful to get the generated require config without having to write it to a file first.

This may also make it easier to do certain tests, by mocking bower dependency graphs and generating configs from those graphs.