component/builder.js — pull request #148 by yields (2014-01-15 17:41:06+00:00)
Title: rework

sorry about that huge diff, i squashed all commits into one :s

this pull request aims to simplify the builder by pulling all of `component.json` and some sources `templates, scripts, styles, json`, plugins can now loop the components and remove / add / change them.

a couple of notes:

- i didn't remove aliases, i guess we can do that later on when we add `semver` support.
- i tested this on some apps and huge components, everything seems to work.
- i didn't trust the `repo: ` field because some components have incorrect one and some don't even have it.
- i know @ianstormtaylor have some suggestions for shortcuts ? maybe `.scripts(fn)`.

here is how you build a simple component with `scripts: [...]`

```js
builder(__dirname)
.use(builder.commonjs('scripts')) // => wraps all scripts in `require.register(...)`
.use(builder.concat('scripts')) // => concats all `scripts`
.build(function(err, build){
var js = build.requirejs;
js += build.scripts;
js += build.aliases;
write('out.js', js);
});
```

/cc @visionmedia