diff --git a/docs/vocs/scripts/fix-search-index.ts b/docs/vocs/scripts/fix-search-index.ts index fae6be6cf8..99b53971f7 100644 --- a/docs/vocs/scripts/fix-search-index.ts +++ b/docs/vocs/scripts/fix-search-index.ts @@ -14,6 +14,7 @@ async function fixSearchIndex() { if (!searchIndexFile) { console.error('❌ No search index file found in .vocs directory'); process.exit(1); + return; } console.log(`📁 Found search index: ${searchIndexFile}`); @@ -55,7 +56,7 @@ async function fixSearchIndex() { } async function findFiles(dir: string, extension: string, files: string[] = []): Promise { - const { readdir, stat } = await import('fs/promises'); + const { readdir } = await import('fs/promises'); const entries = await readdir(dir, { withFileTypes: true }); for (const entry of entries) { @@ -65,7 +66,7 @@ async function findFiles(dir: string, extension: string, files: string[] = []): if (entry.name === '.vocs' || entry.name === 'docs' || entry.name === '_site') continue; if (entry.isDirectory()) { - await findFiles(fullPath, extension, files); + files = await findFiles(fullPath, extension, files); } else if (entry.name.endsWith(extension)) { files.push(fullPath); } @@ -75,4 +76,4 @@ async function findFiles(dir: string, extension: string, files: string[] = []): } // Run the fix -fixSearchIndex().catch(console.error); \ No newline at end of file +fixSearchIndex().catch(console.error);