Merge pull request #5698 from NodeBB/build-tests

Tests for `./nodebb build`
This commit is contained in:
Barış Soner Uşaklı
2017-05-23 19:16:50 -04:00
committed by GitHub
9 changed files with 218 additions and 8 deletions

View File

@@ -180,6 +180,11 @@ function build(targets, callback) {
async.series([
beforeBuild,
function (next) {
var threads = parseInt(nconf.get('threads'), 10);
if (threads) {
require('./minifier').maxThreads = threads - 1;
}
var parallel = !nconf.get('series');
if (parallel) {
winston.info('[build] Building in parallel mode');

View File

@@ -41,9 +41,21 @@ function setupDebugging() {
var pool = [];
var free = [];
Minifier.maxThreads = os.cpus().length - 1;
var maxThreads = 0;
winston.verbose('[minifier] utilizing a maximum of ' + Minifier.maxThreads + ' additional threads');
Object.defineProperty(Minifier, 'maxThreads', {
get: function () {
return maxThreads;
},
set: function (val) {
maxThreads = val;
winston.verbose('[minifier] utilizing a maximum of ' + maxThreads + ' additional threads');
},
configurable: true,
enumerable: true,
});
Minifier.maxThreads = os.cpus().length - 1;
Minifier.killAll = function () {
pool.forEach(function (child) {
@@ -156,7 +168,7 @@ function concat(data, callback) {
return callback(err);
}
var output = files.join(os.EOL + ';');
var output = files.join('\n;');
callback(null, { code: output });
});