File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed
packages/docusaurus-plugin-openapi-docs/src Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -476,11 +476,7 @@ custom_edit_url: null
476
476
cwd : path . resolve ( apiDir ) ,
477
477
deep : 1 ,
478
478
} ) ;
479
- const schemaMdxFiles = await Globby ( [ "*.schema.mdx" ] , {
480
- cwd : path . resolve ( apiDir , "schemas" ) ,
481
- deep : 1 ,
482
- } ) ;
483
- const sidebarFile = await Globby ( [ "sidebar.js" ] , {
479
+ const sidebarFile = await Globby ( [ "sidebar.js" , "sidebar.ts" ] , {
484
480
cwd : path . resolve ( apiDir ) ,
485
481
deep : 1 ,
486
482
} ) ;
@@ -497,20 +493,17 @@ custom_edit_url: null
497
493
} )
498
494
) ;
499
495
500
- schemaMdxFiles . map ( ( mdx ) =>
501
- fs . unlink ( `${ apiDir } /schemas/${ mdx } ` , ( err ) => {
502
- if ( err ) {
503
- console . error (
504
- chalk . red ( `Cleanup failed for "${ apiDir } /schemas/${ mdx } "` ) ,
505
- chalk . yellow ( err )
506
- ) ;
507
- } else {
508
- console . log (
509
- chalk . green ( `Cleanup succeeded for "${ apiDir } /schemas/${ mdx } "` )
510
- ) ;
511
- }
512
- } )
513
- ) ;
496
+ try {
497
+ fs . rmSync ( `${ apiDir } /schemas` , { recursive : true } ) ;
498
+ console . log ( chalk . green ( `Cleanup succeeded for "${ apiDir } /schemas"` ) ) ;
499
+ } catch ( err : any ) {
500
+ if ( err . code !== "ENOENT" ) {
501
+ console . error (
502
+ chalk . red ( `Cleanup failed for "${ apiDir } /schemas"` ) ,
503
+ chalk . yellow ( err )
504
+ ) ;
505
+ }
506
+ }
514
507
515
508
sidebarFile . map ( ( sidebar ) =>
516
509
fs . unlink ( `${ apiDir } /${ sidebar } ` , ( err ) => {
You can’t perform that action at this time.
0 commit comments