@@ -3,6 +3,7 @@ import * as path from 'path';
33import * as Contracts from './contracts' ;
44import * as Helpers from './helpers' ;
55import * as mkdirp from 'mkdirp' ;
6+ import * as clc from 'cli-color' ;
67
78const HEADER_COMMENT = '/* Generated by main-file-generator */' ;
89
@@ -11,7 +12,10 @@ export default class Generator {
1112
1213 public async Generate ( ) {
1314 let fullPath = path . join ( process . cwd ( ) , this . config . baseDir , this . config . out ) ;
14- this . readDtsFile ( fullPath ) ;
15+ console . log ( clc . cyanBright ( 'Bundled dts file:' ) , fullPath ) ;
16+ this . readDtsFile ( fullPath ) . catch ( ( err ) => {
17+ console . error ( err ) ;
18+ } ) ;
1519 }
1620
1721 private async readDtsFile ( fullPath : string ) {
@@ -30,16 +34,18 @@ export default class Generator {
3034 }
3135
3236 private writeFiles ( matches : Array < string > ) {
37+ console . info ( clc . yellow ( 'Generating files:' ) ) ;
3338 matches . forEach ( ( match : string ) => {
3439 let cleanedMatch = this . cleanModule ( match ) ;
35- let fullFilePath = path . join ( process . cwd ( ) , this . config . proxyjs . generateDir , `${ match } .js` ) ;
40+ let fullFilePath = path . join ( process . cwd ( ) , this . config . proxyjs . generateDir , `${ match } .js` ) ;
3641 // Make sure that all folders are created.
3742 mkdirp . sync ( path . dirname ( fullFilePath ) ) ;
3843
3944 // Get `require` relative path.
4045 let requireFileFullPath = path . join ( process . cwd ( ) , this . config . proxyjs . requireFile ) ;
4146 let requireFileRelativePath = path . relative ( fullFilePath , requireFileFullPath ) ;
4247
48+ console . log ( fullFilePath ) ;
4349 //Write to file
4450 let stream = fs . createWriteStream ( fullFilePath , { 'flags' : 'w' } ) ;
4551 let moduleName = Helpers . kebabCaseToPascalCase ( cleanedMatch ) ;
@@ -50,6 +56,7 @@ export default class Generator {
5056 ] . join ( '\r\n' ) ) ;
5157 stream . end ( ) ;
5258 } ) ;
59+ console . info ( clc . green ( 'Done generating files.' ) ) ;
5360 }
5461
5562 private generateLine ( requirePath : string , moduleName : string ) {
0 commit comments