MCPcopy Create free account
hub / github.com/LevelUpWeb3/app / collectMdxFiles

Function collectMdxFiles

scripts/processEventsMarkdown.js:9–24  ·  view source on GitHub ↗
(dir, relativePath = "")

Source from the content-addressed store, hash-verified

7const outputDirectory = path.join(process.cwd(), "public/data/events");
8
9const collectMdxFiles = (dir, relativePath = "") => {
10 let results = [];
11 const list = fs.readdirSync(dir);
12 list.forEach((file) => {
13 const fullPath = path.join(dir, file);
14 const stat = fs.statSync(fullPath);
15 if (stat && stat.isDirectory()) {
16 results = results.concat(
17 collectMdxFiles(fullPath, path.join(relativePath, file)),
18 );
19 } else if (file.endsWith(".mdx")) {
20 results.push({ fullPath, relativePath: path.join(relativePath, file) });
21 }
22 });
23 return results;
24};
25
26const processEventsMarkdownFiles = async () => {
27 const filePaths = collectMdxFiles(markdownDirectory);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected