@@ -11,7 +11,7 @@ import typedocJson from './typedoc.js';
11
11
* @param {string } options.outDir
12
12
* @param {Partial<import('typedoc').TypeDocOptions> } [typeDocOptions]
13
13
*/
14
- export async function createTypeScriptApiDocs ( { entryPoint , outDir } , typeDocOptions ) {
14
+ export async function createTypeScriptApiDocs ( { outDir } , typeDocOptions = { } ) {
15
15
const app = new td . Application ( ) ;
16
16
app . options . addReader ( new td . TSConfigReader ( ) ) ;
17
17
console . log ( 'createTypeScriptApiDocs' , typeDocOptions ) ;
@@ -21,26 +21,34 @@ export async function createTypeScriptApiDocs ({ entryPoint, outDir }, typeDocOp
21
21
} ) ;
22
22
console . log ( 'files' , files ) ;
23
23
app . bootstrap ( {
24
- tsconfig : 'tsconfig.json' ,
24
+ logger : "console" ,
25
+ disableSources : true ,
26
+ cleanOutputDir : true ,
27
+ tsconfig : 'tsconfig.doc.json' ,
28
+ entryPointStrategy : td . EntryPointStrategy . Expand ,
29
+ entryPoints : files ,
25
30
...typedocJson ,
26
- ...typeDocOptions ,
27
- entryPoints : files
31
+ ...typeDocOptions
28
32
} ) ;
29
33
//@ts -ignore
30
34
app . options . setCompilerOptions ( files , {
31
35
esModuleInterop : true
32
36
} ) ;
33
- const program = ts . createProgram ( app . options . getFileNames ( ) , app . options . getCompilerOptions ( ) ) ;
37
+ // const program = ts.createProgram(app.options.getFileNames(), app.options.getCompilerOptions());
34
38
35
- const project = app . converter . convert ( app . expandInputFiles ( app . options . getValue ( 'entryPoints' ) ) , program ) ;
39
+ const project = app . converter . convert ( app . getEntryPoints ( ) ?? [ ] ) ;
36
40
37
41
if ( project ) {
38
42
await app . generateDocs ( project , outDir ) ;
39
43
} else {
40
- throw new Error ( `Error creating the TypeScript API docs for ${ entryPoint } . ` ) ;
44
+ throw new Error ( `Error creating the typedoc project ` ) ;
41
45
}
42
46
} ;
43
47
// app.generateDocs(project, "./docs");
44
48
// app.generateJson(project, "./docs.json");
45
49
46
- createTypeScriptApiDocs ( { outDir : './docs' } ) ;
50
+ try {
51
+ await createTypeScriptApiDocs ( { outDir : './docs' } ) ;
52
+ } catch ( err ) {
53
+ console . error ( err ) ;
54
+ }
0 commit comments