如何为原理图创建任务?

时间:2018-10-15 07:53:45

标签: angular typescript angular-cli angular-schematics

角度示意图有一些tasks。 我想创建自己的任务以与脚本执行器一起运行。 An example of how angular does this

此刻,我刚刚在原理图的末尾生成了预定义的任务。

1 个答案:

答案 0 :(得分:0)

我能够注册执行程序,但不支持,因为我使用的是私有字段。这是您需要做的:

const host = <NodeModulesEngineHost>(<any>context.engine)._host; // this line is not supported
host.registerTaskExecutor<YourFactoryOptions>({
  name: "your-executor-name",
  create: (opt) => import('../path/to/executor').then(mod => mod.default(opt))
});

您可以see on Github如何创建任务执行者注册,然后实际上是registered here