MCPcopy Index your code
hub / github.com/adobe/react-spectrum / getPageLinks

Function getPageLinks

scripts/testDocs.js:65–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65async function getPageLinks() {
66 const packagePaths = [
67 'packages/@react-{spectrum,aria,stately}/*/docs/*.mdx',
68 'packages/react-aria-components/docs/**/*.mdx',
69 'packages/@internationalized/*/docs/*.mdx'
70 ];
71
72 const rootPages = 'packages/dev/docs/pages/**/*.mdx';
73
74 let links = [];
75
76 for (const pattern of packagePaths) {
77 const files = await glob(pattern);
78 for (const file of files) {
79 const parts = file.split(path.sep);
80 const packageName = parts[1].replace('@', '');
81 const componentName = path.basename(file, '.mdx');
82 links.push(`/${packageName}/${componentName}.html`);
83 }
84 }
85
86 const rootFiles = await glob(rootPages);
87 for (const file of rootFiles) {
88 const relativePath = path.relative('packages/dev/docs/pages', file);
89 const urlPath = path.join('/', path.dirname(relativePath), path.basename(relativePath, '.mdx'));
90 links.push(`${urlPath}.html`);
91 }
92
93 return links;
94}
95
96async function testDocs() {
97 let server;

Callers 1

testDocsFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected