MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / remapTarget

Function remapTarget

packages/cli/src/commands/add.ts:37–56  ·  view source on GitHub ↗
(
  item: RegistryItem,
  originalTarget: string,
  paths: { blocks: string; components: string },
)

Source from the content-addressed store, hash-verified

35// without editing every item's manifest.
36
37export function remapTarget(
38 item: RegistryItem,
39 originalTarget: string,
40 paths: { blocks: string; components: string },
41): string {
42 if (item.type === "hyperframes:block") {
43 // Anchored to the default target prefix from DEFAULT_PROJECT_CONFIG.paths.blocks.
44 // Targets that don't start with "compositions/" pass through unchanged.
45 // Strip trailing slashes to prevent double-slash in output.
46 const blocksDir = paths.blocks.replace(/\/+$/, "");
47 return originalTarget.replace(/^compositions\//, `${blocksDir}/`);
48 }
49 if (item.type === "hyperframes:component") {
50 // Anchored to the default target prefix from DEFAULT_PROJECT_CONFIG.paths.components.
51 const componentsDir = paths.components.replace(/\/+$/, "");
52 return originalTarget.replace(/^compositions\/components\//, `${componentsDir}/`);
53 }
54 // Examples are installed by `init`, not `add` — no remapping.
55 return originalTarget;
56}
57
58// ── Include-snippet builders ────────────────────────────────────────────────
59// Shown to the user after install so they know how to wire the item into

Callers 2

runAddFunction · 0.85
add.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected