0

I'm trying to write a generator. It paused after printing app name in terminal.

How to let it executing the copyFile action ?

var Generator = require('yeoman-generator');

module.exports = class extends Generator {
  // The name `constructor` is important here
  constructor(args, opts) {
    // Calling the super constructor is important so our generator is correctly set up
    super(args, opts);

    this.argument("proname", {
      type: String,
      required: true
    });
  }

  askFor() {
    const done = this.async();

    this.prompt([{
      type: "input",
      name: "name",
      message: "Your crx name",
      default: 'myCrx' // Default to current folder name
    }, {
      name: 'description',
      message: 'How would you like to describe this extension?',
      default: 'My Chrome Extension'
    }
    ]).then(function (answers){
      this.log("app name", answers.name); 
      this.name = answers.name.replace(/\"/g, '\\"');
      done();
    }.bind(this));
  }

  copyFile() {
    this.log('Creating templates');
    this.fs.copy(
      this.templatePath('./'),
      this.destinationPath('./' + this.options.proname)
    );
  }

};
duXing
  • 1,377
  • 1
  • 10
  • 24

1 Answers1

0

Updating yo@^3.3.1 from 2.x solved this issue.

duXing
  • 1,377
  • 1
  • 10
  • 24