原理图-向RunSchematicTask添加强制标志

问题描述

我正在编写自己的原理图,我想通过以下方式运行多个原理图(自定义和外部): 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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...