Skip to content

Commit dfa4bed

Browse files
authored
Fix validate-content-style.js with correct paths
1 parent a8a316b commit dfa4bed

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

β€Ždocusaurus/scripts/style-validation/validate-content-style.jsβ€Ž

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,20 @@ class DocumentationValidator {
8484
}
8585

8686
// Get all markdown files in docs directory
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-
];
87+
// The script runs from docusaurus/ directory, so docs/ is relative to that
88+
const docsPath = path.join(process.cwd(), 'docs');
9489

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'));
90+
if (!fs.existsSync(docsPath)) {
91+
this.log('❌ docs/ directory not found', 'error');
92+
this.log(`πŸ’‘ Looking in: ${docsPath}`, 'debug');
10993
return [];
11094
}
11195

11296
const pattern = path.join(docsPath, '**/*.{md,mdx}');
11397
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');
98+
99+
this.log(`πŸ” Pattern: ${pattern}`, 'debug');
100+
this.log(`πŸ“„ Found ${files.length} files`, 'debug');
116101

117102
return files;
118103
}

0 commit comments

Comments
Β (0)