remove side-effects key, update React docs for cherry-picking (#1485)

* remove side-effects, update React docs for cherry-picking

* prettier

* add PR #

* prettier

* fix react import paths

* Update docs/pages/frameworks/react.md

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>

* add colons to imports

---------

Co-authored-by: Cory LaViska <cory@abeautifulsite.net>
This commit is contained in:
Konnor Rogers
2023-08-07 13:20:34 -04:00
committed by GitHub
parent 8aab94f184
commit 31ef2f7929
64 changed files with 611 additions and 341 deletions

View File

@@ -24,9 +24,12 @@ components.map(component => {
const tagWithoutPrefix = component.tagName.replace(/^sl-/, '');
const componentDir = path.join(reactDir, tagWithoutPrefix);
const componentFile = path.join(componentDir, 'index.ts');
const importPath = component.path;
const importPath = component.path.replace(/\.js$/, '.component.js');
const eventImports = (component.events || [])
.map(event => `import { ${event.eventName} } from '../../../src/events/events';`)
.map(event => `import type { ${event.eventName} } from '../../../src/events/events';`)
.join('\n');
const eventExports = (component.events || [])
.map(event => `export type { ${event.eventName} } from '../../../src/events/events';`)
.join('\n');
const eventNameImport =
(component.events || []).length > 0 ? `import { type EventName } from '@lit-labs/react';` : ``;
@@ -46,6 +49,7 @@ components.map(component => {
${eventNameImport}
${eventImports}
${eventExports}
const tagName = '${component.tagName}'