@@ -106,11 +106,38 @@ function addAppToWorkspaceFile(options: ApplicationOptions, workspace: Workspace
106
106
? projectRoot
107
107
: projectRoot + 'src/' ;
108
108
109
+ const schematics : JsonObject = { } ;
110
+
111
+ if ( options . inlineTemplate === true
112
+ || options . inlineStyle === true
113
+ || options . style !== 'css' ) {
114
+ schematics [ '@schematics/angular:component' ] = { } ;
115
+ if ( options . inlineTemplate === true ) {
116
+ ( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineTemplate = true ;
117
+ }
118
+ if ( options . inlineStyle === true ) {
119
+ ( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineStyle = true ;
120
+ }
121
+ if ( options . style && options . style !== 'css' ) {
122
+ ( schematics [ '@schematics/angular:component' ] as JsonObject ) . styleext = options . style ;
123
+ }
124
+ }
125
+
126
+ if ( options . skipTests === true ) {
127
+ [ 'class' , 'component' , 'directive' , 'guard' , 'module' , 'pipe' , 'service' ] . forEach ( ( type ) => {
128
+ if ( ! ( `@schematics/angular:${ type } ` in schematics ) ) {
129
+ schematics [ `@schematics/angular:${ type } ` ] = { } ;
130
+ }
131
+ ( schematics [ `@schematics/angular:${ type } ` ] as JsonObject ) . spec = false ;
132
+ } ) ;
133
+ }
134
+
109
135
// tslint:disable-next-line:no-any
110
136
const project : any = {
111
137
root : projectRoot ,
112
138
projectType : 'application' ,
113
139
prefix : options . prefix || 'app' ,
140
+ schematics,
114
141
architect : {
115
142
build : {
116
143
builder : '@angular-devkit/build-angular:browser' ,
@@ -221,34 +248,6 @@ function addAppToWorkspaceFile(options: ApplicationOptions, workspace: Workspace
221
248
222
249
workspace . projects [ options . name ] = project ;
223
250
224
- const schematics : JsonObject = { } ;
225
-
226
- if ( options . inlineTemplate === true
227
- || options . inlineStyle === true
228
- || options . style !== 'css' ) {
229
- schematics [ '@schematics/angular:component' ] = { } ;
230
- if ( options . inlineTemplate === true ) {
231
- ( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineTemplate = true ;
232
- }
233
- if ( options . inlineStyle === true ) {
234
- ( schematics [ '@schematics/angular:component' ] as JsonObject ) . inlineStyle = true ;
235
- }
236
- if ( options . style && options . style !== 'css' ) {
237
- ( schematics [ '@schematics/angular:component' ] as JsonObject ) . styleext = options . style ;
238
- }
239
- }
240
-
241
- if ( options . skipTests === true ) {
242
- [ 'class' , 'component' , 'directive' , 'guard' , 'module' , 'pipe' , 'service' ] . forEach ( ( type ) => {
243
- if ( ! ( `@schematics/angular:${ type } ` in schematics ) ) {
244
- schematics [ `@schematics/angular:${ type } ` ] = { } ;
245
- }
246
- ( schematics [ `@schematics/angular:${ type } ` ] as JsonObject ) . spec = false ;
247
- } ) ;
248
- }
249
-
250
- workspace . schematics = schematics ;
251
-
252
251
host . overwrite ( getWorkspacePath ( host ) , JSON . stringify ( workspace , null , 2 ) ) ;
253
252
} ;
254
253
}
0 commit comments