【问题标题】:do not run loop queue when specify argument in yeoman generator在 yeoman 生成器中指定参数时不要运行循环队列
【发布时间】:2017-08-01 21:02:28
【问题描述】:

Yeoman 生成器默认会运行所有定义的函数,现在我想指定一个带有yo my_generator model username:string password:string 的参数作为隔离命令来创建模型文件,但不要运行提示和复制模板

module.exports = class extends Generator {
  constructor(args, opts) {
    super(args, opts);

    this.argument('model', {desc: 'model generete', required: false, type: String})
  }

  prompting(){
    ....
  }

  copyTemplates(){
    ...
  }

  model(){
    this.log('only run when "model" argument provide')
  }
};

【问题讨论】:

    标签: node.js yeoman yeoman-generator yo


    【解决方案1】:

    有子生成器:yo my_generator:model

    folder tree section of official documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-14
      • 2015-06-26
      • 2014-05-19
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多