<commit_before>'use strict'
import _ from 'lodash'
import {argv} from 'yargs'
import inquirer from 'inquirer'
import {join} from 'path'
import mkdirp from 'mkdirp'
import pify from 'pify'
import {readdir, readFile, writeFile} from 'fs'

/**
 * proj/
 *  templates/
 *    tests/
 *      components/
 *        __name___test.js
 *        prompts.js
 *    components/
 *      __name__.js
 *      __name__.html
 *      prompts.js
 */

const {_: args} = argv
const [templatePath] = args

let answers = {}
  , files = []

const replaceFileNameWithVar = fileName => {
  let name = fileName

  Object.keys(answers).forEach(answer => {
    name = name.replace(`__${answer}__`, answers[answer])
  })

  return name
}

// create promptsFile path
const promptsFile = join(process.cwd(), 'templates', templatePath, 'prompts.js')
// ask questions from prompts.js
new Promise(resolve => {
  /* eslint-disable global-require */
  inquirer.prompt(require(promptsFile), results => resolve(results))
  /* eslint-enable global-require */
})
  .then(promptResults => {
    answers = promptResults<commit_msg>style(prompts): move const to local scope<commit_after>'use strict'
import _ from 'lodash'
import {argv} from 'yargs'
import inquirer from 'inquirer'
import {join} from 'path'
import mkdirp from 'mkdirp'
import pify from 'pify'
import {readdir, readFile, writeFile} from 'fs'

/**
 * proj/
 *  templates/
 *    tests/
 *      components/
 *        __name___test.js
 *        prompts.js
 *    components/
 *      __name__.js
 *      __name__.html
 *      prompts.js
 */

const {_: args} = argv
const [templatePath] = args

let answers = {}
  , files = []

const replaceFileNameWithVar = fileName => {
  let name = fileName

  Object.keys(answers).forEach(answer => {
    name = name.replace(`__${answer}__`, answers[answer])
  })

  return name
}

// ask questions from prompts.js
new Promise(resolve => {
  // create promptsFile path
  const promptsFile = join(process.cwd(), 'templates', templatePath, 'prompts.js')

  /* eslint-disable global-require */
  inquirer.prompt(require(promptsFile), results => resolve(results))
  /* eslint-enable global-require */
})
  .then(promptResults => {
    answers = promptResults
{'fraction_non_alphanumeric': 0.1346938775510204, 'fraction_numerical': 0.0, 'mean_word_length': 3.368316831683168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2792052', 'n_tokens_mistral': 721, 'n_tokens_neox': 701, 'n_words': 178}