Merge pull request #188 from Cambalab/setup

Be sure to finnish write before script ends
This commit is contained in:
David Baldwynn 2017-07-05 14:57:13 -07:00 committed by GitHub
commit efc8e61454

View file

@ -198,14 +198,16 @@ if(!fs.existsSync('./\.env')) {
var pass = answers['password']; var pass = answers['password'];
delete answers['email']; delete answers['email'];
delete answers['password']; delete answers['password'];
envfile.stringify(answers, function (err, str) { envfile.stringify(answers, function (err, str) {
fs.outputFile('./\.env', str, function (fileErr) { try {
if (fileErr) { fs.outputFileSync('./\.env', str);
return console.error(chalk.red(fileErr)); } catch (fileErr) {
} return console.error(chalk.red(fileErr));
console.log(chalk.green('Successfully created .env file')); }
});
console.log(chalk.green('Successfully created .env file'));
user = new User({ user = new User({
firstName: 'Admin', firstName: 'Admin',
lastName: 'Account', lastName: 'Account',
@ -220,9 +222,9 @@ if(!fs.existsSync('./\.env')) {
if (err) { if (err) {
return console.error(chalk.red(userSaveErr)); return console.error(chalk.red(userSaveErr));
} }
console.log(chalk.green('Successfully created user')); console.log(chalk.green('Successfully created user'));
console.log(chalk.green('Have fun using TellForm!')); console.log(chalk.green('Have fun using TellForm!'));
process.exit(1); process.exit(1);
}); });
@ -230,6 +232,7 @@ if(!fs.existsSync('./\.env')) {
}); });
} else { } else {
console.log(chalk.green('Have fun using TellForm!')); console.log(chalk.green('Have fun using TellForm!'));
process.exit(1);
} }
}); });
} else { } else {