@@ -11,7 +11,7 @@ import typedocJson from './typedoc.js';
1111 * @param {string } options.outDir
1212 * @param {Partial<import('typedoc').TypeDocOptions> } [typeDocOptions]
1313 */
14- export async function createTypeScriptApiDocs ( { entryPoint , outDir } , typeDocOptions ) {
14+ export async function createTypeScriptApiDocs ( { outDir } , typeDocOptions = { } ) {
1515 const app = new td . Application ( ) ;
1616 app . options . addReader ( new td . TSConfigReader ( ) ) ;
1717 console . log ( 'createTypeScriptApiDocs' , typeDocOptions ) ;
@@ -21,26 +21,34 @@ export async function createTypeScriptApiDocs ({ entryPoint, outDir }, typeDocOp
2121 } ) ;
2222 console . log ( 'files' , files ) ;
2323 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 ,
2530 ...typedocJson ,
26- ...typeDocOptions ,
27- entryPoints : files
31+ ...typeDocOptions
2832 } ) ;
2933 //@ts -ignore
3034 app . options . setCompilerOptions ( files , {
3135 esModuleInterop : true
3236 } ) ;
33- const program = ts . createProgram ( app . options . getFileNames ( ) , app . options . getCompilerOptions ( ) ) ;
37+ // const program = ts.createProgram(app.options.getFileNames(), app.options.getCompilerOptions());
3438
35- const project = app . converter . convert ( app . expandInputFiles ( app . options . getValue ( 'entryPoints' ) ) , program ) ;
39+ const project = app . converter . convert ( app . getEntryPoints ( ) ?? [ ] ) ;
3640
3741 if ( project ) {
3842 await app . generateDocs ( project , outDir ) ;
3943 } else {
40- throw new Error ( `Error creating the TypeScript API docs for ${ entryPoint } . ` ) ;
44+ throw new Error ( `Error creating the typedoc project ` ) ;
4145 }
4246} ;
4347// app.generateDocs(project, "./docs");
4448// app.generateJson(project, "./docs.json");
4549
46- createTypeScriptApiDocs ( { outDir : './docs' } ) ;
50+ try {
51+ await createTypeScriptApiDocs ( { outDir : './docs' } ) ;
52+ } catch ( err ) {
53+ console . error ( err ) ;
54+ }
0 commit comments