MCPcopy Create free account
hub / github.com/cometchat/cometchat-uikit-angular / findDocFile

Function findDocFile

scripts/docs-audit.ts:117–132  ·  view source on GitHub ↗

* Finds the MDX doc file for a component. * Checks multiple naming conventions used in the docs/ directory: * - cometchat-{name}.mdx (e.g., cometchat-conversations.mdx) * - {name}.mdx without prefix (e.g., button.mdx, avatar.mdx) * - {name-without-cometchat}.mdx (e.g., groups.mdx for cometchat-g

(componentDirName: string)

Source from the content-addressed store, hash-verified

115 * - {name-without-cometchat}.mdx (e.g., groups.mdx for cometchat-groups)
116 */
117function findDocFile(componentDirName: string): string | null {
118 // Try exact match: cometchat-conversations.mdx
119 const exactPath = path.join(DOCS_DIR, `${componentDirName}.mdx`);
120 if (fs.existsSync(exactPath)) {
121 return exactPath;
122 }
123
124 // Try without cometchat- prefix: conversations.mdx
125 const withoutPrefix = componentDirName.replace(/^cometchat-/, '');
126 const shortPath = path.join(DOCS_DIR, `${withoutPrefix}.mdx`);
127 if (fs.existsSync(shortPath)) {
128 return shortPath;
129 }
130
131 return null;
132}
133
134/**
135 * Scans docs/components/ and returns a set of all .mdx file paths.

Callers 1

auditComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected