问题描述
我正在编写自己的原理图,我想通过以下方式运行多个原理图(自定义和外部):
ng add @some/schematics
默认情况下,我需要在ngAdd使用--force
调用的某些原理图中放置_context.addTask(new RunSchematicTask('otherSchematicsName',_options))
标志……我的意思是,类似于下一个代码,但带有--force
标志
import { Rule,SchematicContext,Tree } from '@angular-devkit/schematics';
import { RunSchematicTask } from '@angular-devkit/schematics/tasks';
// You don't have to export the function as default. You can also have more than one rule factory
// per file.
export function ngAdd(_options: any): Rule {
return (tree: Tree,_context: SchematicContext) => {
_context.addTask(new RunSchematicTask('deps',_options));
_context.addTask(new RunSchematicTask('@angular/material','ng-add',{
..._options,theme: "custom",typography: true,animations: true
}));
return tree;
};
}
我尝试运行ng add @some/schematics --force
,但由于下一个错误而失败(我需要覆盖文件):
ERROR! src/app/app.component.html already exists.
The Schematic workflow Failed. See above.
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)