@@ -5,6 +5,7 @@ import { BuildContext } from './util/interfaces';
5
5
import { readFileAsync , writeFileAsync } from './util/helpers' ;
6
6
import { getTypescriptSourceFile , appendNgModuleDeclaration , insertNamedImportIfNeeded } from './util/typescript-utils' ;
7
7
import { applyTemplates , filterOutTemplates , getNgModules , GeneratorOption , GeneratorRequest , hydrateRequest , readTemplates , writeGeneratedFiles } from './generators/util' ;
8
+ import * as path from 'path' ;
8
9
9
10
export { getNgModules , GeneratorOption , GeneratorRequest } ;
10
11
@@ -19,10 +20,12 @@ export function processPageRequest(context: BuildContext, name: string) {
19
20
20
21
export function processPipeRequest ( context : BuildContext , name : string , ngModulePath : string ) {
21
22
const hydratedRequest = hydrateRequest ( context , { type : 'pipe' , name } ) ;
22
-
23
+ console . log ( hydratedRequest ) ;
24
+ console . log ( ngModulePath ) ;
23
25
return readFileAsync ( ngModulePath ) . then ( ( fileContent : string ) => {
24
- fileContent = insertNamedImportIfNeeded ( ngModulePath , fileContent , name , `./${ name } ` ) ;
25
- fileContent = appendNgModuleDeclaration ( ngModulePath , fileContent , name ) ;
26
+ fileContent = insertNamedImportIfNeeded ( ngModulePath , fileContent , hydratedRequest . className , path . relative ( path . dirname ( ngModulePath ) , hydratedRequest . dirToWrite ) ) ;
27
+ fileContent = appendNgModuleDeclaration ( ngModulePath , fileContent , hydratedRequest . className ) ;
28
+ console . log ( fileContent ) ;
26
29
return writeFileAsync ( ngModulePath , fileContent ) ;
27
30
} ) . then ( ( ) => {
28
31
return processNonTabRequest ( context , hydratedRequest ) ;
0 commit comments