const Generator = require('yeoman-generator');
const changeCase = require('change-case');

module.exports = class PinguComponentGenerator extends Generator {
  prompting() {
    return this.prompt([
      {
        type: 'list',
        name: 'tier',
        message: 'Which category shall the component belong to?',
        choices: ['atoms', 'molecules', 'organisms'],
      },
      {
        type: 'input',
        name: 'name',
        message: 'What shall the component be called?',
      }
    ]).then(answers => {
      this.tier = answers.tier;
      this.name = answers.name;
    });
  }

  writing() {
    const dashed = changeCase.param(this.name);

    this.fs.copyTpl(
      this.templatePath('component.scss'),
      this.destinationPath(`src/components/${this.tier}/${dashed}/${dashed}.scss`),
      { name: changeCase.param(dashed) }
    );

    this.fs.copyTpl(
      this.templatePath('index.js'),
      this.destinationPath(`src/components/${this.tier}/${dashed}/index.js`),
      {
        original: this.name,
        proper: changeCase.pascal(this.name),
        dashed,
      }
    );

    this.fs.copyTpl(
      this.templatePath('component.test.js'),
      this.destinationPath(`src/components/${this.tier}/${dashed}/${dashed}.test.js`),
      { proper: changeCase.pascal(this.name) }
    );


    // if (!this.createFiles) {
    //   return;
    // }

    // const files = [
    //   'default-state.js',
    //   'index.js',
    //   'reducers.js',
    //   'store.js',
    //   'assets/styles.scss',
    //   'sagas/root.js',
    // ];

    // files.map(file => this.fs.copyTpl(this.templatePath(file), this.destinationPath(`src/${file}`)));
  }

  end() {
    this.log(`🐧  enjoyed creating a ${this.tier} that is cool as ice for you.`);
  }
}

@@ -1315,360 +1315,8 @@
  );%0A
-%0A%0A    // if (!this.createFiles) %7B%0A    //   return;%0A    // %7D%0A%0A    // const files = %5B%0A    //   'default-state.js',%0A    //   'index.js',%0A    //   'reducers.js',%0A    //   'store.js',%0A    //   'assets/styles.scss',%0A    //   'sagas/root.js',%0A    // %5D;%0A%0A    // files.map(file =%3E this.fs.copyTpl(this.templatePath(file), this.destinationPath(%60src/$%7Bfile%7D%60)));%0A
   %7D%0A

Remove commented code