我正在尝试为角度cli创建自定义原理图。到目前为止,我已经知道“集合”必须被编译,cli不能读取打字稿。这意味着你不能只克隆https://github.com/angular/devkit/tree/master/packages/schematics/angular改变任何你需要并将其发布在故宫,这意味着你需要克隆整个https://github.com/angular/devkit,并使用其需要run it thru tsc编译原理图,你就可以发布这些编译的文件,以NPM和全球范围内安装有NPM,例如角度cli自定义原理图/集合npm run build
创建
npm i -g @thescrollbar/schematics
那么我应该已经能够做到ng new [email protected]/schematics my-app
,但令人惊讶的是,它没有工作,被扔tree.branch is not a function
。
但是如果你这个全球安装包复制到CLI的模块
/usr/local/bin/node_modules/@thescrollbar/schematics
- >/usr/local/bin/node_modules/@angular/cli/node_modules/@thescrollbar/schematics
它开始工作,你可以创建一个基于您的原理图新的应用..
现在对于新问题,我没有解决方法,当我尝试生成一个新的组件
ng g c [email protected]/schematics logo
它使用它@schematics/angular
模板,而不是我的收藏,尽管事实上,当我故意做创建
ng g shat [email protected]/schematics logo
它说
原理图“虱”不是在集合中没有找到“@ thescrollbar /原理”。
我认为这清楚地表明它的确在使用我的收藏?
任何人设法让自定义集合工作?全球和生成组件/模块?
我加了一些片段和信息https://github.com/angular/angular-cli/issues/7744从我已经能够得到到目前为止工作。 – Splaktar