twitter/bower — pull request #73 by uzquiano (2012-10-02 18:56:21+00:00)
Title: Support for multiple endpoints in search and lookup

In sticking to Bower's objective of being the best darn tootinest package manager for the web, I'd recommend supporting multiple endpoints configured in a search path so that dependency resolution can be layered. This is pretty common with server-side frameworks (like Maven) where you may want to take advantage of a public Bower repository while also maintaining your own.

There are a number of good reasons for having multiple registries. You might, for example, have things you don't want to release for general consumption (say, very app-specific, project-specific or client-specific). There may be confidentiality reasons. You also might not want to clutter the public namespace given that component.json only defines a single string identifier (Note: this will be problematic down the road).

My recommendation is to add a __searchpath__ property to the Bower configuration. In the work being contributed by KarthikDot, we can provide a __.bowerrc__ file to override configuration. That's pretty much all we'd need.

You could shimmy up something like this:

```json
{
"directory" : "components",
"json" : "component.json",
"endpoint" : "http://bower.mycompany.com",
"searchpath" : ["https://bower.herokuapp.com"]
}
```

This would let my project search my company's components registry and if it can't find things there, it'll look to the main registry. For example - jQuery is a pretty common dependency and one that Bower already provides in its public registry. It's useful therefore to fallback.

I put together an implementation. All of the search functions essentially walk the list of endpoints rather than going after a single endpoint:
https://github.com/uzquiano/bower

I included a good bit of what Karthik coded up so that a merge would be easier.

What does the community think? If this is useful, please indicate and perhaps we can see something like this merged into core.

Michael