Skip to content

Commit 1cd33f5

Browse files
committed
fix: collectMarkdown now returns correct paths
- Use `fs.readdirSync(..., { encoding: 'utf8', recursive: true })` to keep sub-folder paths intact and avoid the `string | Buffer` type issue that broke Prettier in Zeta-House-Docs.
1 parent 0c5d3a3 commit 1cd33f5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/utils.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,21 @@ function findUserESLintConfig(repoRoot = process.cwd()): string | undefined {
116116
* @returns An array of paths to Markdown files.
117117
*/
118118
function collectMarkdown(dir: string): string[] {
119-
const entries = fs.readdirSync(dir, { withFileTypes: true, recursive: true });
120-
return entries
121-
.filter((e) => e.isFile() && /\.(md|mdx)$/i.test(e.name))
122-
.map((e) => path.join(dir, e.name));
119+
const files = fs.readdirSync(dir, { encoding: 'utf8', recursive: true });
120+
121+
return files
122+
.filter((f) => /\.(md|mdx)$/i.test(f))
123+
.map((f) => path.join(dir, f));
123124
}
124125

126+
// function collectMarkdown(dir: string): string[] {
127+
// const entries = fs.readdirSync(dir, { withFileTypes: true, recursive: true });
128+
// return entries
129+
// .filter((e) => e.isFile() && /\.(md|mdx)$/i.test(e.name))
130+
// .map((e) => path.join(dir, e.name));
131+
// }
132+
133+
125134
/**
126135
* Check if a command exists in the system PATH.
127136
*

0 commit comments

Comments
 (0)