MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / walk

Function walk

apps/docs/scripts/check-unused-components.mjs:22–39  ·  view source on GitHub ↗
(dir, exts)

Source from the content-addressed store, hash-verified

20const REFERENCE_EXTS = [".astro", ".mdx", ".md", ".ts", ".tsx", ".mjs"];
21
22function walk(dir, exts) {
23 const out = [];
24
25 for (const entry of readdirSync(dir)) {
26 const full = join(dir, entry);
27
28 if (statSync(full).isDirectory()) {
29 out.push(...walk(full, exts));
30 continue;
31 }
32
33 if (exts.some((ext) => full.endsWith(ext))) {
34 out.push(full);
35 }
36 }
37
38 return out;
39}
40
41const componentFiles = walk(COMPONENTS_DIR, [".tsx"]);
42const sources = walk(SRC, REFERENCE_EXTS).map((file) => ({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected