Skip to content

Commit

Permalink
remove eliteDependencies & magic path detection behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Jun 29, 2015
1 parent 571d469 commit 02b7410
Show file tree
Hide file tree
Showing 89 changed files with 52 additions and 3,003 deletions.
38 changes: 6 additions & 32 deletions lib/detect-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,6 @@ function mergeSort(items) {
}


/**
* Some dependencies which we know should always come first.
*/
var eliteDependencies = [
'es5-shim',
'jquery',
'zepto',
'modernizr'
];


/**
* Sort the dependencies in the order we can best determine they're needed.
*
Expand All @@ -291,29 +280,14 @@ var eliteDependencies = [
* @return {array} the sorted items of 'path/to/main/files.ext' sorted by type
*/
function prioritizeDependencies(config, fileType) {
var eliteDependenciesCaught = [];

var dependencies = mergeSort(
$._.toArray(config.get('global-dependencies').get()).
filter(function (dependency) {
return $._.contains(dependency.type, fileType);
}).
filter(function (dependency) {
if ($._.contains(eliteDependencies, dependency.name)) {
eliteDependenciesCaught.push(dependency.main);
} else {
return true;
}
})
).map($.propprop('main'));
var globalDependencies = $._.toArray(config.get('global-dependencies').get());

eliteDependenciesCaught.
forEach(function (dependency) {
dependencies.unshift(dependency);
});
var dependencies = globalDependencies.filter(function (dependency) {
return $._.contains(dependency.type, fileType);
});

return $._
(dependencies).
return $._(mergeSort(dependencies)).
map($.propprop('main')).
flatten().
value().
filter(function (main) {
Expand Down
8 changes: 1 addition & 7 deletions lib/inject-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var $ = {

var config;
var fileTypes;
var filesCaught = [];
var globalDependenciesSorted;
var ignorePath;

Expand All @@ -22,7 +21,6 @@ function injectDependencies(globalConfig) {
config = globalConfig;
var stream = config.get('stream');

filesCaught = [];
globalDependenciesSorted = config.get('global-dependencies-sorted');
ignorePath = config.get('ignore-path');
fileTypes = config.get('file-types');
Expand Down Expand Up @@ -62,9 +60,8 @@ function replaceIncludes(file, fileType, returnType) {
(string.substr(0, offset) + string.substr(offset + match.length)).
replace(oldScripts, '').
replace(fileType.block, '').
replace(fileType.detect[blockType], function (match, reference) {
replace(fileType.detect[blockType], function (match) {
quoteMark = match.match(/['"]/) && match.match(/['"]/)[0];
filesCaught.push(reference.replace(/['"\s]/g, ''));
});

if (!quoteMark) {
Expand All @@ -83,9 +80,6 @@ function replaceIncludes(file, fileType, returnType) {
$.path.basename(filePath)
).replace(/\\/g, '/').replace(ignorePath, '');
}).
filter(function (filePath) {
return filesCaught.indexOf(filePath) === -1;
}).
forEach(function (filePath) {
if (typeof fileType.replace[blockType] === 'function') {
newFileContents += spacing + fileType.replace[blockType](filePath);
Expand Down
1 change: 0 additions & 1 deletion test/fixture/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "wiredep-test",
"version": "0.0.0",
"dependencies": {
"modernizr": "2.6.2",
"codecode": "0.0.3",
"bootstrap": "3.0.0",
"modular-scale": "2.0.3",
Expand Down
1 change: 0 additions & 1 deletion test/fixture/bower_after_uninstall.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "wiredep-test",
"version": "0.0.0",
"dependencies": {
"modernizr": "~2.6.2",
"bootstrap": "~3.0.0"
}
}
13 changes: 0 additions & 13 deletions test/fixture/bower_components/modernizr/bower.json

This file was deleted.

Loading

0 comments on commit 02b7410

Please sign in to comment.