@@ -177,15 +177,15 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
177177 if ( endSetup ) {
178178 return await endSetup ( ) ;
179179 }
180- tree . write ( appConfigPath , appConfigSourceFile . print ( ) ) ;
180+ tree . write ( appConfigPath , appConfigSourceFile . getFullText ( ) ) ;
181181 }
182182
183183 if ( Node . isObjectLiteralExpression ( configArgument ) ) {
184184 const endSetup = await handleAppConfig ( tree , configArgument , mainSourceFile ) ;
185185 if ( endSetup ) {
186186 return await endSetup ( ) ;
187187 }
188- tree . write ( mainTsPath , mainSourceFile . print ( ) ) ;
188+ tree . write ( mainTsPath , mainSourceFile . getFullText ( ) ) ;
189189 }
190190
191191 if ( options . sceneGraph === 'none' ) {
@@ -221,7 +221,8 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
221221 message : `Enter the path to the component (from ${ app . sourceRoot } )` ,
222222 name : 'componentPath' ,
223223 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 ) ) {
225226 return `[NGT] Please use the path to the component TS file.` ;
226227 }
227228 return true ;
@@ -237,7 +238,7 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
237238 scriptKind : ScriptKind . TS ,
238239 } ) ;
239240
240- const decorators = componentSourceFile . getChildrenOfKind ( SyntaxKind . Decorator ) ;
241+ const decorators = componentSourceFile . getDescendantsOfKind ( SyntaxKind . Decorator ) ;
241242 const componentDecorators = decorators . filter ( ( decorator ) => decorator . getName ( ) === 'Component' ) ;
242243 if ( componentDecorators . length !== 1 ) {
243244 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) {
313314 }
314315
315316 await componentSourceFile . save ( ) ;
316- tree . write ( componentPath , componentSourceFile . print ( ) ) ;
317+ tree . write ( componentPath , componentSourceFile . getFullText ( ) ) ;
317318 return await finishSetup ( tree ) ;
318319}
319320
0 commit comments