@@ -37,7 +37,7 @@ shelljs.mkdir('-p', DOCGEN_PACKAGE_DIR);
37
37
// Register hook to cleanup temp dir
38
38
nodeCleanup ( ( ) => {
39
39
const symlinks = fs . readdirSync ( DOCGEN_DIR )
40
- . filter ( file => fs . lstatSync ( file ) . isSymbolicLink ( ) ) ;
40
+ . filter ( file => fs . lstatSync ( file ) . isSymbolicLink ( ) ) ;
41
41
symlinks . forEach ( file => fs . unlinkSync ( file ) ) ;
42
42
shelljs . rm ( '-rf' , DOCGEN_DIR ) ;
43
43
} ) ;
@@ -53,7 +53,7 @@ includes.forEach(include => {
53
53
const versionline = _exec ( `yarn list --pattern ${ package } ` ) . stdout
54
54
. split ( / [ \r \n ] + / ) . find ( line => line . includes ( package ) ) ;
55
55
const match = / .* \@ ( ( [ ^ @ ] * ?) ( - [ a - z A - Z 0 - 9 ] { 8 } ) ? $ ) / . exec ( versionline ) ;
56
- const version = match [ 2 ] ;
56
+ const version = match [ 2 ] ;
57
57
console . log ( { versionline } ) ;
58
58
console . log ( { match } ) ;
59
59
console . log ( { version } ) ;
@@ -86,13 +86,25 @@ const cmdLineOpts = Object.keys(typedocOptions)
86
86
. join ( " " ) ;
87
87
88
88
process . chdir ( DOCGEN_DIR ) ;
89
+
90
+ const possibleEs6LibPaths = [
91
+ 'node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts' ,
92
+ 'node_modules/typescript/lib/lib.es6.d.ts' ,
93
+ ] . map ( libPath => path . join ( PACKAGE_DIR , libPath ) ) ;
94
+
95
+ const es6LibPath = possibleEs6LibPaths . find ( libPath => fs . existsSync ( libPath ) ) ;
96
+
97
+ if ( ! es6LibPath ) {
98
+ throw new Error ( `Couldn't find lib.es6.d.ts at ${ possibleEs6LibPaths . join ( ' nor ' ) } ` ) ;
99
+ }
100
+
89
101
const files = [ ]
90
102
. concat ( TYPEDOC_CONFIG . files || [ ] )
91
103
. concat ( TS_CONFIG . files . map ( x => path . join ( DOCGEN_PACKAGE_DIR , x ) ) )
92
104
. concat ( includes . map ( x => path . join ( DOCGEN_DIR , kebob ( x . package ) , x . entry ) ) )
93
105
. map ( x => `${ path . normalize ( x ) } ` )
94
106
. map ( x => `./${ path . relative ( DOCGEN_DIR , x ) } ` )
95
- . concat ( path . join ( PACKAGE_DIR , 'node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts' ) ) ;
107
+ . concat ( es6LibPath ) ;
96
108
97
109
// run typedoc command
98
110
_exec ( `npx typedoc ${ cmdLineOpts } ${ files . join ( ' ' ) } ` ) ;
0 commit comments