import { Rule , Tree } from '@angular-devkit/schematics' ; import { logError } from '../../shared/log-helper' ; export function updatePublicAPI ( path , paths ) { return ( tree ) => { try { const publicAPIFile = path + '/public-api.ts' ; tree . overwrite ( publicAPIFile , generatePublicAPIcontent ( paths ) ) ; } catch ( e ) { console . error ( e ) ; logError ( `Something went wrong: Do you have multiple modules in ${ path }` ) ; } } ; } export function generatePublicAPIcontent ( paths ) { let result = '' ; paths . forEach ( ( path ) => { if ( ! path . includes ( 'spec.ts' ) ) { result += `export * from '${ path . split ( '.ts' ) [ 0 ] }';\n` ; } } ) ; return result ; }