问题描述
限时送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:关键词]
发布评论