replace all paths in CEM

This commit is contained in:
Cory LaViska
2022-11-10 16:27:23 -05:00
parent 40cb38e0a0
commit cc305f8957
3 changed files with 44 additions and 23 deletions

View File

@@ -29,7 +29,7 @@ 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.modulePath.replace(/^src\//, '').replace(/\.ts$/, '');
const importPath = component.path;
const events = (component.events || []).map(event => `${event.reactName}: '${event.name}'`).join(',\n');
fs.mkdirSync(componentDir, { recursive: true });

View File

@@ -5,10 +5,10 @@ export function getAllComponents(metadata) {
module.declarations?.map(declaration => {
if (declaration.customElement) {
const component = declaration;
const modulePath = module.path;
const path = module.path;
if (component) {
allComponents.push(Object.assign(component, { modulePath }));
allComponents.push(Object.assign(component, { path }));
}
}
});