<commit_before>'use strict'
var Generator = require('yeoman-generator')
var chalk = require('chalk')
var yosay = require('yosay')

module.exports = Generator.extend({
  prompting: function () {

    this.log(
      `Let\'s make a ${chalk.cyan('react')} component!` +
      `\nThis generator will create a react container component skeleton for you.\n`
    )

    const prompts = [
      {
        type: 'input',
        name: 'name',
        message: 'Name your component (MyComponent)',
        default: 'MyComponent'
      },
      {
        type: 'confirm',
        name: 'includeCss',
        message: 'Do you want a CSS file?',
        default: true
      },
      {
        type: 'input',
        name: 'filepath',
        message: `Enter the path to the existing folder where your new component ${chalk.bold('folder')} should be placed`,
        default: './src/components'
      }
    ]

    return this.prompt(prompts)
      .then((props) => this.props = props)
  },

  writing: function () {
    this.destinationRoot(this.props.filepath + '/' + this.props.name)
    this.fs.copyTpl(
      this.templatePath('__Component.jsx'),
      this.destinationPath(this.props.name + '.jsx'),
      this.props
    )
    if (this.props.includeCss) {
      this.fs.copy(
        this.templatePath('__Component.css'),
        this.destinationPath(this.props.name + '.css')
      )
    }
  }
})<commit_msg>Make prompts better for component root path<commit_after>'use strict'
var Generator = require('yeoman-generator')
var chalk = require('chalk')
var yosay = require('yosay')

module.exports = Generator.extend({
  prompting: function () {

    this.log(
      '\n\n' +
      `Let\'s make a ${chalk.cyan('react')} component!\n` +
      `This generator will create a react container component skeleton for you.\n\n` +
      `${chalk.red('Note')} - you don't need to include slashes in any responses :-).\n\n`
    )

    const pathRoot = this.config.get('componentRoot')
    const hasCustomRoot = !!pathRoot

    const prompts = [
      {
        type: 'input',
        name: 'name',
        message: 'Name your component (MyComponent)',
        default: 'MyComponent'
      },
      {
        type: 'confirm',
        name: 'includeCss',
        message: 'Do you want a CSS file?',
        default: true
      }
    ]

    if (hasCustomRoot) {
      prompts.push({
        type: 'input',
        name: 'filepath',
        message: `Component folder will be placed in your component root (${pathRoot}). Enter any additional path here:`,
        default: ''
      })
    } else {
      prompts.push({
        type: 'input',
        name: 'filepath',
        message: 'Enter path to where the new component folder should be placed:',
        default: './src/components'
      })
    }

    return this.prompt(prompts)
      .then((props) => {
        this.props = props
        if (hasCustomRoot) this.props.filepath = pathRoot + '/' + this.props.filepath
      })
  },

  writing: function () {
    this.destinationRoot(this.props.filepath + '/' + this.props.name)
    this.fs.copyTpl(
      this.templatePath('__Component.jsx'),
      this.destinationPath(this.props.name + '.jsx'),
      this.props
    )
    if (this.props.includeCss) {
      this.fs.copy(
        this.templatePath('__Component.css'),
        this.destinationPath(this.props.name + '.css')
      )
    }
  }
})
{'fraction_non_alphanumeric': 0.14196799051570835, 'fraction_numerical': 0.0, 'mean_word_length': 2.2766990291262137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7460663', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1021, 'n_words': 251}