@@ -84,14 +84,37 @@ class DocumentationValidator {
8484 }
8585
8686 // Get all markdown files in docs directory
87- const docsPath = path . join ( process . cwd ( ) , 'docs' ) ;
88- if ( ! fs . existsSync ( docsPath ) ) {
89- this . log ( '❌ docs/ directory not found' , 'error' ) ;
87+ // Try different possible locations
88+ const possibleDocsPaths = [
89+ path . join ( process . cwd ( ) , 'docs' ) ,
90+ path . join ( process . cwd ( ) , '..' , 'docs' ) , // If running from docusaurus/
91+ path . join ( __dirname , '..' , 'docs' ) ,
92+ path . join ( __dirname , '..' , '..' , 'docs' )
93+ ] ;
94+
95+ let docsPath = null ;
96+
97+ for ( const testPath of possibleDocsPaths ) {
98+ if ( fs . existsSync ( testPath ) ) {
99+ docsPath = testPath ;
100+ this . log ( `📁 Using docs path: ${ docsPath } ` , 'debug' ) ;
101+ break ;
102+ }
103+ }
104+
105+ if ( ! docsPath ) {
106+ this . log ( '❌ docs/ directory not found in any expected location' , 'error' ) ;
107+ this . log ( '💡 Tried paths:' , 'debug' ) ;
108+ possibleDocsPaths . forEach ( p => this . log ( ` - ${ p } ` , 'debug' ) ) ;
90109 return [ ] ;
91110 }
92111
93112 const pattern = path . join ( docsPath , '**/*.{md,mdx}' ) ;
94- return glob . sync ( pattern ) ;
113+ const files = glob . sync ( pattern ) ;
114+ this . log ( `🔍 Pattern used: ${ pattern } ` , 'debug' ) ;
115+ this . log ( `📄 Found files: ${ files . slice ( 0 , 5 ) . join ( ', ' ) } ${ files . length > 5 ? '...' : '' } ` , 'debug' ) ;
116+
117+ return files ;
95118 }
96119
97120 async validateFile ( filePath ) {
@@ -285,4 +308,4 @@ if (require.main === module) {
285308 main ( ) . catch ( console . error ) ;
286309}
287310
288- module . exports = DocumentationValidator ;
311+ module . exports = DocumentationValidator ;
0 commit comments