Yeoman-генератор приостановлен после запроса - PullRequest
0 голосов
/ 05 мая 2020

Пытаюсь написать генератор. Он приостановился после печати app name в терминале.

Как разрешить ему выполнение действия copyFile?

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)
    );
  }

};

1 Ответ

0 голосов
/ 06 июня 2020

Обновление yo@^3.3.1 с 2.x решило эту проблему.

...