在《自耕农》中选择在哪里生成命令



我正在构建一个生成器,我需要在最后的npm install在我的应用程序中的某个目录,我尝试了这样的事情:

this.spawnCommandSync('cd', [this.destinationRoot() + '/my/folder'])
this.spawnCommandSync('npm', ['install'])

但是它不工作。

并且npm install不能在不同的目录中调用,也不能在任何yeoman安装mixins中调用。

传递选项cwd -就像https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options

最新更新