【发布时间】:2018-12-16 19:37:29
【问题描述】:
我创建了一个带有用户交互的yeoman generator,可以在终端中调用它(运行npm link之后):
yo mygenerator --name test --path /test/path --project testproject
现在我想在我的 vscode 扩展中包含这个生成器。
当生成器被添加为 package.json 依赖项时,如何从我的打字稿代码中调用 yo 生成器?
类似(伪代码)
import { yo } from 'yeoman';
import mygenerator; // added as a dependency via package.json
const options = {
name: 'test',
path: '/test/path',
project: 'testproject',
};
yo.exec(mygenerator, options, () => {
console.log('yeoman finished')
});
这样的事情可能吗?
【问题讨论】: