From 7cd8274c0f99fa6173e75351a5738913880a24a8 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Sun, 1 Jul 2018 22:11:38 -0600
Subject: [PATCH] Add series flag for `./nodebb build`
---
src/cli/index.js | 5 +++--
src/meta/build.js | 12 ++++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/cli/index.js b/src/cli/index.js
index cece70d554..20f7c85271 100644
--- a/src/cli/index.js
+++ b/src/cli/index.js
@@ -186,8 +186,9 @@ program
program
.command('build [targets...]')
.description('Compile static assets ' + '(JS, CSS, templates, languages, sounds)'.red)
- .action(function (targets) {
- require('./manage').build(targets.length ? targets : true);
+ .option('-s, --series', 'Run builds in series without extra processes')
+ .action(function (targets, options) {
+ require('./manage').build(targets.length ? targets : true, options);
})
.on('--help', function () {
require('./manage').buildTargets();
diff --git a/src/meta/build.js b/src/meta/build.js
index 62399ec2e7..62288dad3a 100644
--- a/src/meta/build.js
+++ b/src/meta/build.js
@@ -134,13 +134,22 @@ function buildTargets(targets, parallel, 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) {
targets = allTargets;
} else if (!Array.isArray(targets)) {
targets = targets.split(',');
}
+ var parallel = !nconf.get('series') && !options.series;
+
targets = targets
// get full target name
.map(function (target) {
@@ -200,7 +209,6 @@ function build(targets, callback) {
require('./minifier').maxThreads = threads - 1;
}
- var parallel = !nconf.get('series');
if (parallel) {
winston.info('[build] Building in parallel mode');
} else {