MCPcopy Create free account
hub / github.com/break-stuff/cem-tools / getModulePath

Function getModulePath

packages/react-wrappers/src/utils.ts:12–30  ·  view source on GitHub ↗
(
  modulePath: ((className: string, tagName: string) => string) | undefined,
  component: Component,
  outdir: string,
  packageJson: any,
)

Source from the content-addressed store, hash-verified

10}
11
12export function getModulePath(
13 modulePath: ((className: string, tagName: string) => string) | undefined,
14 component: Component,
15 outdir: string,
16 packageJson: any,
17) {
18 if (modulePath instanceof Function) {
19 return modulePath(component.name, component.tagName!);
20 }
21
22 if (!packageJson.module) {
23 throw new Error(
24 "You must define a module path in order to generate React wrappers.",
25 );
26 }
27
28 const directories = outdir?.split("/");
29 return path.join(directories.map(() => "../").join(""), packageJson.module);
30}
31
32export const createEventName = (event: any) => `on${toPascalCase(event.name)}`;
33

Callers 1

generateReactWrappersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected