【问题标题】:NX Schematics, how to call own schematicNX Schematics,如何调用自己的原理图
【发布时间】:2019-08-27 03:22:50
【问题描述】:

我找不到如何使用ng g workspace-schematic <schematic-name> NX 使用新创建的原理图

这是我的结构:

|- tools/
  |- schematics
   |- my-first-schematic
   |- my-second-schematic

我想在my-second-schematic 中使用my-first-schematic。 我知道externalSchematic(),但是当我们想从另一个集合调用 schematif 时它很有用。

谢谢!

【问题讨论】:

    标签: angular-schematics nrwl-nx


    【解决方案1】:

    我们可以直接将 my-first-schematic 导入到 my-second-schematic 中,然后简单地链接起来。 例如

    工具/schematics/my-first-schematics/index.ts

    export default function(schema: any): Rule {
        console.log('my-first-schematics');
    }
    

    工具/schematics/my-second-schematic/index.ts

     import myFirstSchematics from '../my-first-schematics';
    
     export default function(schema: any): Rule {
         console.log('my-second-schematic');
         ...
         return chain([
             myFirstSchematics(schema),
             ...
         ]);
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-30
      • 2018-10-01
      • 2020-04-23
      • 2019-03-16
      • 1970-01-01
      • 2013-01-24
      • 2020-08-21
      • 1970-01-01
      相关资源
      最近更新 更多