simplify deps management

This commit is contained in:
mourner 2011-12-12 12:10:22 +02:00
parent f2a2868ed3
commit a278c982b2

View File

@ -1,11 +1,10 @@
var fs = require('fs'), var fs = require('fs'),
uglify = require('uglify-js'), uglify = require('uglify-js'),
jshint = require('jshint'), //jshint = require('jshint'),
deps = require('./build/deps.js').deps; deps = require('./build/deps.js').deps;
function getFiles(compsBase32) { function getFiles(compsBase32) {
var memo = {}, var memo = {},
i, srcs, j, len,
comps; comps;
if (compsBase32) { if (compsBase32) {
@ -13,27 +12,28 @@ function getFiles(compsBase32) {
console.log('Managing dependencies...') console.log('Managing dependencies...')
} }
var log = []; function addFiles(srcs) {
for (var j = 0, len = srcs.length; j < len; j++) {
for (i in deps) { memo[srcs[j]] = true;
srcs = deps[i].src;
if (!comps || (parseInt(comps.pop(), 2) === 1)) {
if (comps) {
console.log('\t* ' + i);
}
for (j = 0, len = srcs.length; j < len; j++) {
memo[srcs[j]] = true;
}
} else if (comps) {
console.log('\t ' + i);
} }
} }
var files = [], for (var i in deps) {
src; if (comps) {
if (parseInt(comps.pop(), 2) === 1) {
console.log('\t* ' + i);
addFiles(deps[i].src);
} else {
console.log('\t ' + i);
}
} else {
addFiles(deps[i].src);
}
}
for (src in memo) { var files = [];
for (var src in memo) {
files.push('src/' + src); files.push('src/' + src);
} }