@@ -11,7 +11,6 @@ import {
1111 template ,
1212 url ,
1313 mergeWith ,
14- filter ,
1514} from '@angular-devkit/schematics' ;
1615
1716import { dasherize } from '@angular-devkit/core/src/utils/strings' ;
@@ -58,7 +57,7 @@ export default function (options: ComponentOptions): Rule {
5857 extensions = getExtensions ( tree , options ) ;
5958 componentInfo = parseComponentInfo ( tree , options ) ;
6059 } ,
61-
60+
6261 ( tree : Tree ) => {
6362 if ( options . skipImport ) {
6463 return tree ;
@@ -90,17 +89,17 @@ export default function (options: ComponentOptions): Rule {
9089
9190 ( tree : Tree , context : SchematicContext ) => {
9291 if ( platformUse . useWeb ) {
93- return renameFile ( tree , componentInfo . templatePath ) ;
92+ return addWebExtension ( tree , componentInfo . templatePath ) ;
9493 } else {
95- return removeFile ( tree , context , componentInfo . templatePath ) ;
94+ return removeFile ( tree , componentInfo . templatePath ) ;
9695 }
9796 } ,
9897
9998 ( tree : Tree , context : SchematicContext ) => {
10099 if ( platformUse . useWeb ) {
101- return renameFile ( tree , componentInfo . stylesheetPath ) ;
100+ return addWebExtension ( tree , componentInfo . stylesheetPath ) ;
102101 } else {
103- return removeFile ( tree , context , componentInfo . stylesheetPath ) ;
102+ return removeFile ( tree , componentInfo . stylesheetPath ) ;
104103 }
105104 } ,
106105
@@ -147,18 +146,18 @@ const parseComponentInfo = (tree: Tree, options: ComponentOptions): ComponentInf
147146 return component ;
148147}
149148
150- const renameFile = ( tree : Tree , filePath : string ) => {
149+ const addWebExtension = ( tree : Tree , filePath : string ) => {
151150 if ( extensions . web ) {
152151 const webName = insertExtension ( filePath , extensions . web ) ;
153152 tree . rename ( filePath , webName ) ;
154153 }
155154 return tree ;
156155} ;
157156
158- const removeFile = ( tree : Tree , context : SchematicContext , filePath : string ) =>
159- filter (
160- ( path : Path ) => ! path . match ( filePath )
161- ) ( tree , context )
157+ const removeFile = ( tree : Tree , filePath : string ) => {
158+ tree . delete ( filePath ) ;
159+ return tree ;
160+ }
162161
163162const addNativeScriptFiles = ( component : ComponentInfo ) => {
164163 const parsedTemplate = parseName ( '' , component . templatePath ) ;
0 commit comments