@@ -177,15 +177,15 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
177
177
if ( endSetup ) {
178
178
return await endSetup ( ) ;
179
179
}
180
- tree . write ( appConfigPath , appConfigSourceFile . print ( ) ) ;
180
+ tree . write ( appConfigPath , appConfigSourceFile . getFullText ( ) ) ;
181
181
}
182
182
183
183
if ( Node . isObjectLiteralExpression ( configArgument ) ) {
184
184
const endSetup = await handleAppConfig ( tree , configArgument , mainSourceFile ) ;
185
185
if ( endSetup ) {
186
186
return await endSetup ( ) ;
187
187
}
188
- tree . write ( mainTsPath , mainSourceFile . print ( ) ) ;
188
+ tree . write ( mainTsPath , mainSourceFile . getFullText ( ) ) ;
189
189
}
190
190
191
191
if ( options . sceneGraph === 'none' ) {
@@ -221,7 +221,8 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
221
221
message : `Enter the path to the component (from ${ app . sourceRoot } )` ,
222
222
name : 'componentPath' ,
223
223
validate ( value ) {
224
- if ( ! value . endsWith ( '.ts' ) || ! tree . exists ( value ) ) {
224
+ const fullPath = join ( app . sourceRoot , value ) ;
225
+ if ( ! value . endsWith ( '.ts' ) || ! tree . exists ( fullPath ) ) {
225
226
return `[NGT] Please use the path to the component TS file.` ;
226
227
}
227
228
return true ;
@@ -237,7 +238,7 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
237
238
scriptKind : ScriptKind . TS ,
238
239
} ) ;
239
240
240
- const decorators = componentSourceFile . getChildrenOfKind ( SyntaxKind . Decorator ) ;
241
+ const decorators = componentSourceFile . getDescendantsOfKind ( SyntaxKind . Decorator ) ;
241
242
const componentDecorators = decorators . filter ( ( decorator ) => decorator . getName ( ) === 'Component' ) ;
242
243
if ( componentDecorators . length !== 1 ) {
243
244
return await stopSetup ( tree , `There are no Component or more than one Component in ${ componentPath } ` ) ;
@@ -313,7 +314,7 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
313
314
}
314
315
315
316
await componentSourceFile . save ( ) ;
316
- tree . write ( componentPath , componentSourceFile . print ( ) ) ;
317
+ tree . write ( componentPath , componentSourceFile . getFullText ( ) ) ;
317
318
return await finishSetup ( tree ) ;
318
319
}
319
320
0 commit comments