MCPcopy Index your code
hub / github.com/craftreactnative/ui / copyComponent

Function copyComponent

cli/src/utils/component-manager.ts:117–138  ·  view source on GitHub ↗
(
  componentName: string,
  targetPath: string
)

Source from the content-addressed store, hash-verified

115 * Copies a component from source to target location
116 */
117export async function copyComponent(
118 componentName: string,
119 targetPath: string
120): Promise<void> {
121 const { componentsPath } = await ensureSourcePaths();
122 const sourcePath = path.join(componentsPath, componentName);
123 const destPath = path.join(
124 targetPath,
125 "craftrn-ui",
126 "components",
127 componentName
128 );
129
130 if (!(await fs.pathExists(sourcePath))) {
131 throw new Error(
132 `Component ${componentName} source not found at: ${sourcePath}`
133 );
134 }
135
136 await fs.ensureDir(path.dirname(destPath));
137 await fs.copy(sourcePath, destPath);
138}
139
140/**
141 * Copies all theme files to target location

Callers 1

addCommandFunction · 0.90

Calls 1

ensureSourcePathsFunction · 0.85

Tested by

no test coverage detected