Skip to content

Commit

Permalink
fix(tools): react wrapper syntax errors (#2772)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers authored Jun 16, 2024
1 parent 75c5441 commit 9995136
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-sloths-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@patternfly/pfe-tools": patch
---

**React**: corrected syntax error in some generated modules
6 changes: 3 additions & 3 deletions tools/pfe-tools/react/generate-wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function genJavascriptModule(module: CEM.Module, pkgName: string, data: ReactWra
return javascript`// ${module.path}
import { createComponent } from '@lit/react';
import react from 'react';${data.map(x => javascript`
import { ${x.Class} as elementClass } from '${pkgName}/${module.path}';`)}${data.map(x => javascript`
import { ${x.Class} as elementClass } from '${pkgName}/${module.path}';`).join('')}${data.map(x => javascript`
export const ${x.reactComponentName} = createComponent({
tagName: '${x.tagName}',
elementClass,
Expand All @@ -93,8 +93,8 @@ export const ${x.reactComponentName} = createComponent({
function genTypescriptModule(module: CEM.Module, pkgName: string, data: ReactWrapperData[]) {
return typescript`// ${module.path}
import type { ReactWebComponent } from '@lit/react';${data.map(x => typescript`
import type { ${x.Class} } from '${pkgName}/${module.path}';`)}${data.map(x => typescript`
export const ${x.reactComponentName}: ReactWebComponent<${x.Class}, ${x.eventsInterface}>;`)}
import type { ${x.Class} } from '${pkgName}/${module.path}';`).join('')}${data.map(x => typescript`
export const ${x.reactComponentName}: ReactWebComponent<${x.Class}, ${x.eventsInterface}>;`).join('\n')}
`;
}

Expand Down

0 comments on commit 9995136

Please sign in to comment.