简体   繁体   中英

angular schematics can't create .ts file

I created an Angular Schematics. There are two files in Files folder,fight.html and fight.ts When I run schematics .: ng-add, terminal display create fight.html and fight.ts . And I publish it to npm.I'm on a new Angular Project run ng add packagename, the only fight.html are generated, no fight fight.ts

and this is my schematics stackblitz and my package name is new-schematics

Native angular version

Angular CLI: 8.0.6
Node: 10.15.3
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.800.6
@angular-devkit/core         8.0.6
@angular-devkit/schematics   8.0.6
@schematics/angular          8.0.6
@schematics/update           0.800.6
rxjs                         6.4.0

更改.npmignore *.ts=>.ts

I also had this problem, I simply named my .ts files as __typescript__ and then declared __typescript__ in the template variables, so your file will be: fight.__typescript__

const templateSource = apply(url('./files'), [
  template({
    typescript: 'ts',
  }),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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