Skip to content

Commit 1bf1f0b

Browse files
committed
fix script for undefined tag-names
1 parent 673a141 commit 1bf1f0b

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

packages/main/scripts/create-web-components-wrapper.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
2+
3+
//TODO:
4+
console.warn(
5+
'Currently there are two tag-names missing or faulty: "ui5-notification-overflow-action" and "ui5-timeline-item"\n These have to be adjusted manually!\n'
6+
);
7+
28
const mainWebComponentsSpec = require('@ui5/webcomponents/dist/api.json');
39
const fioriWebComponentsSpec = require('@ui5/webcomponents-fiori/dist/api.json');
410
const dedent = require('dedent');
@@ -401,9 +407,9 @@ const createWebComponentWrapper = (
401407
[${regularProps.map((v) => `'${v}'`).join(', ')}],
402408
[${booleanProps.map((v) => `'${v}'`).join(', ')}],
403409
[${slotProps
404-
.filter((name) => name !== 'children')
405-
.map((v) => `'${v}'`)
406-
.join(', ')}],
410+
.filter((name) => name !== 'children')
411+
.map((v) => `'${v}'`)
412+
.join(', ')}],
407413
[${eventProps.map((v) => `'${v}'`).join(', ')}]
408414
);
409415
@@ -650,6 +656,9 @@ resolvedWebComponents.forEach((componentSpec) => {
650656
property.name = 'children';
651657
}
652658
const propDescription = () => {
659+
if (!componentSpec.tagname) {
660+
return property.description || '';
661+
}
653662
let formattedDescription = (property.description || '')
654663
.replace(/\n\n<br><br> /g, '<br/><br/>\n *\n * ')
655664
.replace(/\n\n/g, '<br/><br/>\n *\n * ')
@@ -664,7 +673,6 @@ resolvedWebComponents.forEach((componentSpec) => {
664673
if (extendedDescription) {
665674
return replaceTagNameWithModuleName(`${formattedDescription}${extendedDescription}`);
666675
}
667-
668676
return replaceTagNameWithModuleName(formattedDescription);
669677
};
670678

@@ -712,14 +720,15 @@ resolvedWebComponents.forEach((componentSpec) => {
712720
description = description.replace(`<h3 class="comment-api-title">Overview</h3>`, '');
713721
//strip ES6 Module import
714722
description = description.slice(0, description.indexOf(`<h3>ES6 Module Import</h3>`));
723+
if (!componentSpec.tagname) {
724+
return description.split(/(?=<h3>)/, 2);
725+
}
715726
//replace tag-name with module-name
716727
description = description.replace(new RegExp(componentSpec.tagname, 'g'), `${componentSpec.module}`);
717728
//replace other ui5 tag-names
718729
description = replaceTagNameWithModuleName(description);
719730
//split string by main description and rest
720-
const descriptionArray = description.split(/(?=<h3>)/, 2);
721-
722-
return descriptionArray;
731+
return description.split(/(?=<h3>)/, 2);
723732
};
724733

725734
const [mainDescription, description = ''] = formatDescription();

0 commit comments

Comments
 (0)