mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: remove another async.series
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const winston = require('winston');
|
const winston = require('winston');
|
||||||
const async = require('async');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const nconf = require('nconf');
|
const nconf = require('nconf');
|
||||||
|
|
||||||
const { install } = require('../../install/web');
|
const { webInstall } = require('../../install/web');
|
||||||
|
|
||||||
function setup(initConfig) {
|
async function setup(initConfig) {
|
||||||
const { paths } = require('../constants');
|
const { paths } = require('../constants');
|
||||||
const install = require('../install');
|
const install = require('../install');
|
||||||
const build = require('../meta/build');
|
const build = require('../meta/build');
|
||||||
@@ -21,12 +20,7 @@ function setup(initConfig) {
|
|||||||
console.log('Press enter to accept the default setting (shown in brackets).');
|
console.log('Press enter to accept the default setting (shown in brackets).');
|
||||||
|
|
||||||
install.values = initConfig;
|
install.values = initConfig;
|
||||||
|
const data = await install.setup();
|
||||||
async.series([
|
|
||||||
async function () {
|
|
||||||
return await install.setup();
|
|
||||||
},
|
|
||||||
function (next) {
|
|
||||||
let configFile = paths.config;
|
let configFile = paths.config;
|
||||||
if (nconf.get('config')) {
|
if (nconf.get('config')) {
|
||||||
configFile = path.resolve(paths.baseDir, nconf.get('config'));
|
configFile = path.resolve(paths.baseDir, nconf.get('config'));
|
||||||
@@ -35,14 +29,8 @@ function setup(initConfig) {
|
|||||||
prestart.loadConfig(configFile);
|
prestart.loadConfig(configFile);
|
||||||
|
|
||||||
if (!nconf.get('skip-build')) {
|
if (!nconf.get('skip-build')) {
|
||||||
build.buildAll(next);
|
await build.buildAll();
|
||||||
} else {
|
|
||||||
setImmediate(next);
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
], (err, data) => {
|
|
||||||
// Disregard build step data
|
|
||||||
data = data[0];
|
|
||||||
|
|
||||||
let separator = ' ';
|
let separator = ' ';
|
||||||
if (process.stdout.columns > 10) {
|
if (process.stdout.columns > 10) {
|
||||||
@@ -52,10 +40,6 @@ function setup(initConfig) {
|
|||||||
}
|
}
|
||||||
console.log(`\n${separator}\n`);
|
console.log(`\n${separator}\n`);
|
||||||
|
|
||||||
if (err) {
|
|
||||||
winston.error(`There was a problem completing NodeBB setup\n${err.stack}`);
|
|
||||||
throw err;
|
|
||||||
} else {
|
|
||||||
if (data.hasOwnProperty('password')) {
|
if (data.hasOwnProperty('password')) {
|
||||||
console.log('An administrative user was automatically created for you:');
|
console.log('An administrative user was automatically created for you:');
|
||||||
console.log(` Username: ${data.username}`);
|
console.log(` Username: ${data.username}`);
|
||||||
@@ -69,11 +53,8 @@ function setup(initConfig) {
|
|||||||
if (process.send) {
|
if (process.send) {
|
||||||
process.send(data);
|
process.send(data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.setup = setup;
|
exports.setup = setup;
|
||||||
exports.webInstall = install;
|
exports.webInstall = webInstall;
|
||||||
|
|||||||
Reference in New Issue
Block a user