node-cube
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -5,3 +5,3 @@ { | ||
"description": "a new way to write js in browser", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/fishbar/cube", | ||
@@ -8,0 +8,0 @@ "repository": { |
57
tools.js
@@ -187,27 +187,18 @@ var xfs = require('xfs'); | ||
analyseNoduleModules(path.join(source, 'node_modules'), nodeModulesMap, function () { | ||
xfs.walk(source, function (p) { | ||
if (/node_modules/.test(p)) { | ||
var stat = xfs.statSync(p); | ||
if (stat.isDirectory()) { | ||
return true; | ||
} | ||
// this is a node_modules dir | ||
return nodeModulesMap[p]; | ||
} | ||
return true; | ||
}, function (err, sourceFile) { | ||
if (err) { | ||
throw err; | ||
} | ||
fileCount++; | ||
// analyseNoduleModules(path.join(source, 'node_modules'), nodeModulesMap, function () { | ||
xfs.walk(source, function (err, sourceFile) { | ||
if (err) { | ||
throw err; | ||
} | ||
fileCount++; | ||
var relFile = sourceFile.substr(root.length); | ||
var destFile = path.join(dest, relFile); | ||
var relFile = sourceFile.substr(root.length); | ||
var destFile = path.join(dest, relFile); | ||
if (/\.min\.(css|js)$/.test(sourceFile) || checkIgnore(relFile, ignores)) { | ||
xfs.sync().save(destFile, xfs.readFileSync(sourceFile)); | ||
console.log('[copy file]:', relFile.substr(1)); | ||
return; | ||
} | ||
if (/\.min\.(css|js)$/.test(sourceFile) || checkIgnore(relFile, ignores)) { | ||
xfs.sync().save(destFile, xfs.readFileSync(sourceFile)); | ||
console.log('[copy file]:', relFile.substr(1)); | ||
return; | ||
} | ||
try { | ||
processFile(cube, sourceFile, destFile, opts, function (err, info) { | ||
@@ -218,10 +209,18 @@ if (err && err.length) { | ||
}); | ||
}, function () { | ||
var end = new Date().getTime(); | ||
cb(errors, { | ||
total: fileCount, | ||
time: Math.ceil((end - st) / 1000) | ||
}); | ||
} catch (e) { | ||
if (/node_modules/.test(sourceFile)) { | ||
// ignore the error | ||
errors.push(e); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
}, function () { | ||
var end = new Date().getTime(); | ||
cb(errors, { | ||
total: fileCount, | ||
time: Math.ceil((end - st) / 1000) | ||
}); | ||
}); | ||
// }); | ||
} | ||
@@ -228,0 +227,0 @@ /** |
695067
3016