MCPcopy Create free account
hub / github.com/Mobilecn-UI/nativecn-ui / fetchComponents

Function fetchComponents

packages/cli/src/utils/registry.ts:20–38  ·  view source on GitHub ↗
(components: string[])

Source from the content-addressed store, hash-verified

18 'https://raw.githubusercontent.com/Mobilecn-UI/nativecn-ui/main';
19
20export async function fetchComponents(components: string[]) {
21 try {
22 const fetchedComponents = await Promise.all(
23 components.map(async component => {
24 const response = await fetch(`${baseUrl}/components/${component}.tsx`);
25 const content = await response.text();
26 return {
27 name: `${component}.tsx`,
28 content,
29 };
30 })
31 );
32
33 return fetchedComponents;
34 } catch (error) {
35 console.error(error);
36 throw new Error(`Failed to fetch components from registry.`);
37 }
38}

Callers 1

add.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected