1- const info = require ( '../info' )
2- const path = require ( 'path' )
3- const fs = require ( 'fs' )
4- const { $log } = require ( 'ts-log-debug' )
5- const { name } = require ( '../../../package.json' )
1+ const info = require ( "../info" ) ;
2+ const path = require ( "path" ) ;
3+ const fs = require ( "fs" ) ;
4+ const { name} = require ( "../../../package.json" ) ;
65
76class DocComponent {
87 /**
98 *
109 * @param file
1110 */
1211 constructor ( file ) {
13- this . file = file
14- this . path = ( file || '' ) . replace ( path . join ( info . root , ' lib/' ) , '' ) . replace ( ' .d.ts' , ' .ts' )
15- this . srcPath = path . resolve ( path . join ( info . root , ' src' , this . path ) )
12+ this . file = file ;
13+ this . path = ( file || "" ) . replace ( path . join ( info . root , " lib/" ) , "" ) . replace ( " .d.ts" , " .ts" ) ;
14+ this . srcPath = path . resolve ( path . join ( info . root , " src" , this . path ) ) ;
1615
17- this . symbol = path . basename ( file ) . replace ( ' .d.ts' , '' )
18- this . module = this . getModule ( )
19- this . symbols = new Map ( )
16+ this . symbol = path . basename ( file ) . replace ( " .d.ts" , "" ) ;
17+ this . module = this . getModule ( ) ;
18+ this . symbols = new Map ( ) ;
2019
21- this . originalContents = fs . readFileSync ( this . srcPath ) . toString ( )
22- this . contents = fs . readFileSync ( file ) . toString ( )
20+ this . originalContents = fs . readFileSync ( this . srcPath ) . toString ( ) ;
21+ this . contents = fs . readFileSync ( file ) . toString ( ) ;
2322
2423 // $log.debug("DocComponent created from", this.file);
2524 }
2625
2726 getModule ( ) {
28- const index = this . path . split ( '/' ) [ 0 ]
29- const docPath = info . modules [ index ] || ' common'
30- const isCommon = docPath . indexOf ( ' common/' ) > - 1
31- const packageName = isCommon ? name : ( name + '/' + index )
27+ const index = this . path . split ( "/" ) [ 0 ] ;
28+ const docPath = info . modules [ index ] || " common" ;
29+ const isCommon = docPath . indexOf ( " common/" ) > - 1 ;
30+ const packageName = isCommon ? name : ( name + "/" + index ) ;
3231 const srcPath = path . resolve (
33- isCommon ? path . join ( info . root , ' src' ) : path . join ( info . root , ' src' , index )
34- )
32+ isCommon ? path . join ( info . root , " src" ) : path . join ( info . root , " src" , index )
33+ ) ;
3534 return {
3635 docPath,
3736 name : packageName ,
3837 srcPath,
3938 isCommon
40- }
39+ } ;
4140 }
4241}
4342
44- module . exports . DocComponent = DocComponent
43+ module . exports . DocComponent = DocComponent ;
0 commit comments