var _ = require('lodash');

/**
 *
 * @param dependencyGraph -- bower dependency graph generated from bower utility
 * @param excludedDependencies -- excluded dependencies
 */
function buildConfig(dependencyGraph, excludedDependencies, application) {

    if (!dependencyGraph.dependencies) return;

    var config = {
        shim: {}
    };

    //bower dependencies shim wiring
    var components = dependencyGraph.dependencies;
    var excludeDependencies = excludedDependencies;
    _.forOwn(components, function (component, key) {
        if (excludeDependencies.indexOf(key) > -1) return;

        if(component.pkgMeta){
            var dependencies = _.keys(component.pkgMeta.dependencies);
            config.shim[key] = {deps: dependencies};
        }

    });

    // application shim wiring
    var applicationName = application.name || dependencyGraph.pkgMeta.name;
    if(dependencyGraph.pkgMeta){
        var applicationDependencies = _.keys(dependencyGraph.pkgMeta.dependencies);
        if(application.exclude){
            applicationDependencies = _.remove(applicationDependencies, function(n){ return application.exclude.indexOf(n) > -1; })
        }

        if(application.overwrite){
            applicationDependencies = _.map(applicationDependencies, function(n){ return (application.overwrite[n])? application.overwrite[n]: n; })
        }
        config.shim[applicationName] = {deps: applicationDependencies};
    }
    return config;
}

module.exports = buildConfig;
@@ -1037,34 +1037,8 @@
     
- applicationDependencies =
  _.r
@@ -1076,25 +1076,24 @@
 function(n)%7B
- 
 return appli
@@ -1122,24 +1122,25 @@
 (n) %3E -1; %7D)
+;
 %0A        %7D%0A%0A

fix bug exclude dependencies a