在生成器完成后调用自耕农生成器

编程入门 行业动态 更新时间:2024-10-19 22:41:55
本文介绍了在生成器完成后调用自耕农生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我希望在第一个生成器安装完成后调用另一个自耕农生成器,这将基于我对其中一个提示给出的答案.

I am looking to call another yeoman generator once the first generator has finished installing, this will be based on an answer I give for one of the prompts.

我尝试在最后调用它.

end: function () {
  this.installDependencies({
    callback: function () {

      if( this.generator2 ){
        shell.exec('yo generator2');
      }

    }.bind(this)
  });
},

这会运行 generator2,但我无法回答任何提示.

This runs generator2, but I am unable to answer any prompts.

这些是 2 个独立的生成器,所以我不能让第二个成为子生成器.

These are 2 separate generators, so I cannot make the second a sub generator.

推荐答案

我看到这是一个较旧的问题,但我遇到了类似的要求 &想要确保列出所有选项.我同意其他答案,即使用 可组合功能 是最佳选择.保持订单无关.但如果真的有必要按顺序运行生成器:您还可以使用集成功能来执行另一个生成器.

I see this is an older question, but I came accross a similar requirement & want to make sure all options are listed. I agree with the other answers that it is the best choice to use the composability feature & keep the order irrelevant. But in case it really is necessary to run generators sequentially: You can also execute another generator using the integration features.

所以在 generator1 中你可以调用

So in generator1 you could call

this.env.run('generator2');

这也可以让您在 generator2 中回答提示.

This will also let you answer prompts in generator2.

这篇关于在生成器完成后调用自耕农生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 19:21:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047617.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:生成器   自耕农   完成后

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!