const chalk = require('chalk');
const fs = require('fs-extra');
const inquirer = require('inquirer');


/**
 * Create a new folder if not exists
 * @param {String} name Folder name
 */
function generateAppFolder(name) {
  console.log(fs.ensureDirSync(name));
  console.log(chalk.green('Folder ready!'));
}


/**
 * Ask the user for permission to overwrite files if the folder exists
 * @param {String} name
 * @return {Promise}
 */
function askForOvewrite(name) {
  return new Promise(resolve => inquirer
    .prompt({
      type: 'confirm',
      name: 'continueConflict',
      message: chalk.bold.bgRed.white(`You have a folder named: '${name}', the some files WILL be overwrited, continue? `),
    })
    .then((anwser) => {
      if (!anwser.continueConflict) {
        process.exit(1);
      }
      generateAppFolder(name);
      resolve(anwser.continueConflict);
    }));
}


/**
 * Check if exists a folder with the same app name
 * @param {String} name - App name
 * @return {Promise}
 */
function checkAppName(name) {
  return new Promise((resolve) => {
    // Check if the folder already exists
    if (fs.existsSync(name)) {
      resolve(askForOvewrite(name));
    } else {
      resolve(generateAppFolder(name));
    }
  });
}

module.exports = checkAppName;

@@ -215,28 +215,16 @@
 me) %7B%0A  
-console.log(
 fs.ensur
@@ -233,25 +233,24 @@
 irSync(name)
-)
 ;%0A  console.

Remove console.log