MCPcopy Create free account
hub / github.com/callstack/react-native-paper / createPageForComponent

Function createPageForComponent

docs/component-docs-plugin/index.js:30–54  ·  view source on GitHub ↗
(targetArray, source)

Source from the content-addressed store, hash-verified

28 }
29
30 function createPageForComponent(targetArray, source) {
31 const [item, subitem] = targetArray;
32 const target = subitem ? `${item}/${subitem}` : item;
33 const targetPath = target + '.mdx';
34 const sourcePath = source + '.tsx';
35
36 // Parse component using component-docs.
37 const doc = parseComponentDocs(path.join(libsRootDir, sourcePath), {
38 root: libsRootDir,
39 });
40
41 // Create directory for the output mdx file.
42 fs.mkdirSync(
43 path.join(docsRootDir, targetPath).split('/').slice(0, -1).join('/'),
44 { recursive: true }
45 );
46
47 // Generate and write mdx file.
48 fs.writeFileSync(
49 path.join(docsRootDir, targetPath),
50 generatePageMDX(doc, source)
51 );
52
53 return doc;
54 }
55
56 return {
57 name: pluginName,

Callers 1

loadContentFunction · 0.85

Calls 1

generatePageMDXFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…