简体   繁体   English

角示意图。 树转换未执行

[英]Angular Schematics. Tree transforms not executing

I've been following the example for creating a custom angular schematic here: Creating your own application template for angular-cli 我一直在遵循以下示例来创建自定义角度示意图: 为angular-cli创建您自己的应用程序模板

And I've gotten it to work as expected on Mac. 而且我已经使其可以在Mac上按预期工作。 However, when I try to build from my schematic on a PC, I just get the basic src files of the schematic without any of the transformations from my custom files in the workspace and src directories. 但是,当我尝试在PC上从原理图构建时,我只是获得了原理图的基本src文件,而没有从工作区和src目录中的自定义文件进行任何转换。

For example, the angular.json and package.json in the source directory at @my-schematic/my-schematic/workspace/files/ 例如,源目录中的my.schematic / my-schematic / workspace / files /中的angular.json和package.json

Are not getting copied over into the new project's root folder. 不会被复制到新项目的根文件夹中。

To build the project I'm using the following steps: 要构建项目,我正在使用以下步骤:

1) npm install -g @angular-devkit/schematics 
1a) npm install -g @angular-devkit/schematics-cli 
2) npm install -g @my-schematic/my-schematic
3) ng new --collection=@my-schematic/my-schematic foldername 
4) cd [foldername] 
5) npm install 
6) ng serve 

the way your files would be 'moved' is by using the 'move' method from the schematic library - you would have to provide the path to this method that would define where your files would go. 文件“移动”的方式是使用原理图库中的“移动”方法-您必须提供此方法的路径,该路径将定义文件的去向。 This move method is applied using 'apply' method to the template() -- 此移动方法是使用'apply'方法应用于template()的-

apply(url(‘./files’), [
    filter( path => !path.match( /\.bak$/) ),
    template( ...strings, ...options ),
    move( options.path || ‘’ )
]);

so without you telling us what this method looks like in your schematic, it'll be hard to debug your problem :) 因此,如果您不告诉我们此方法在原理图中的样子,将很难调试问题:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM