Misc fixes and improvements (#6143)

* `setup` command fixes and improvements

- Enable using the `./nodebb setup` command for auto-setup with a JSON argument
- Change CLI so package-install and dependency install are separate steps
- Fix #6142

* Prevent compiling templates multiple times

- Multiple requests for same template get pooled
- Hopefully fixes the "templateFunction is not a function" error which happens if site is restarted during high-traffic times

* More helpful upgrade template
This commit is contained in:
Peter Jaszkowiak
2017-12-04 13:49:44 -07:00
committed by Julian Lam
parent 3551d7d68e
commit fc19f3af61
6 changed files with 83 additions and 22 deletions

View File

@@ -2,10 +2,13 @@
var winston = require('winston');
var async = require('async');
var path = require('path');
var nconf = require('nconf');
var install = require('../../install/web').install;
function setup() {
function setup(initConfig) {
var paths = require('./paths');
var install = require('../install');
var build = require('../meta/build');
var prestart = require('../prestart');
@@ -17,9 +20,19 @@ function setup() {
console.log('\nThis looks like a new installation, so you\'ll have to answer a few questions about your environment before we can proceed.');
console.log('Press enter to accept the default setting (shown in brackets).');
install.values = initConfig;
async.series([
install.setup,
prestart.loadConfig,
function (next) {
var configFile = paths.config;
if (nconf.get('config')) {
configFile = path.resolve(paths.baseDir, nconf.get('config'));
}
prestart.loadConfig(configFile);
next();
},
build.buildAll,
], function (err, data) {
// Disregard build step data