Add series flag for `./nodebb build`

v1.18.x
Peter Jaszkowiak 7 years ago committed by Julian Lam
parent 8eea6017fe
commit 7cd8274c0f

@ -186,8 +186,9 @@ program
program program
.command('build [targets...]') .command('build [targets...]')
.description('Compile static assets ' + '(JS, CSS, templates, languages, sounds)'.red) .description('Compile static assets ' + '(JS, CSS, templates, languages, sounds)'.red)
.action(function (targets) { .option('-s, --series', 'Run builds in series without extra processes')
require('./manage').build(targets.length ? targets : true); .action(function (targets, options) {
require('./manage').build(targets.length ? targets : true, options);
}) })
.on('--help', function () { .on('--help', function () {
require('./manage').buildTargets(); require('./manage').buildTargets();

@ -134,13 +134,22 @@ function buildTargets(targets, parallel, callback) {
}, callback); }, callback);
} }
function build(targets, callback) { function build(targets, options, callback) {
if (!callback && typeof options === 'function') {
callback = options;
options = {};
} else if (!options) {
options = {};
}
if (targets === true) { if (targets === true) {
targets = allTargets; targets = allTargets;
} else if (!Array.isArray(targets)) { } else if (!Array.isArray(targets)) {
targets = targets.split(','); targets = targets.split(',');
} }
var parallel = !nconf.get('series') && !options.series;
targets = targets targets = targets
// get full target name // get full target name
.map(function (target) { .map(function (target) {
@ -200,7 +209,6 @@ function build(targets, callback) {
require('./minifier').maxThreads = threads - 1; require('./minifier').maxThreads = threads - 1;
} }
var parallel = !nconf.get('series');
if (parallel) { if (parallel) {
winston.info('[build] Building in parallel mode'); winston.info('[build] Building in parallel mode');
} else { } else {

Loading…
Cancel
Save