Skip to content

Commit b923669

Browse files
authored
feat(cli): add deprecation notice of components in wrapper script (#7178)
1 parent f54aa57 commit b923669

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

packages/cli/src/scripts/create-wrappers/ComponentRenderer.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ export class ComponentRenderer extends AbstractRenderer {
1010
private attributes: CEM.ClassField[] = [];
1111
private slots: CEM.Slot[] = [];
1212
private events: CEM.Event[] = [];
13-
private description: string = '';
13+
private description: CEM.ClassLike['description'] = '';
1414
private note: string = '';
1515
private isAbstract: boolean = false;
16-
private since: string | undefined;
17-
private isExperimental: boolean | string | undefined = false;
16+
private since: CEM.ClassLike['_ui5since'];
17+
private isExperimental: CEM.ClassLike['_ui5experimental'] = false;
18+
private isDeprecated: CEM.ClassLike['deprecated'];
1819

1920
setAttributes(attrs: CEM.ClassField[]) {
2021
this.attributes.push(...attrs);
@@ -56,6 +57,11 @@ export class ComponentRenderer extends AbstractRenderer {
5657
return this;
5758
}
5859

60+
setIsDeprecated(value?: CEM.ClassField['deprecated']) {
61+
this.isDeprecated = value;
62+
return this;
63+
}
64+
5965
prepare(context: WebComponentWrapper) {
6066
context.exportSet.add(context.componentName);
6167
}
@@ -77,6 +83,10 @@ export class ComponentRenderer extends AbstractRenderer {
7783
comment += ` * @experimental${typeof this.isExperimental === 'string' ? ` ${this.isExperimental}` : ''}\n`;
7884
}
7985

86+
if (this.isDeprecated) {
87+
comment += ` * @deprecated${typeof this.isDeprecated === 'string' ? ` ${summaryFormatter(this.isDeprecated)}` : ''}\n`;
88+
}
89+
8090
comment += '*/';
8191

8292
const component = dedent`

packages/cli/src/scripts/create-wrappers/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default async function createWrappers(packageName: string, outDir: string
6767
.setIsAbstract(declaration._ui5abstract ?? false)
6868
.setSince(declaration._ui5since)
6969
.setIsExperimental(declaration._ui5experimental)
70+
.setIsDeprecated(declaration.deprecated)
7071
);
7172
wrapper.addRenderer(new ExportsRenderer());
7273

packages/cli/src/util/formatters.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function propDescriptionFormatter(html: string) {
2525
return replaceUi5TagNames(html).replaceAll('\n', '\n * ');
2626
}
2727

28-
export function summaryFormatter(htmlDesc: string) {
28+
export function summaryFormatter(htmlDesc: string | undefined) {
29+
if (!htmlDesc) {
30+
return '';
31+
}
2932
let summary = htmlDesc.replace(/###\s?Overview\n*/, '').replace(/### ES6 Module Import\n*`.+`/, '');
3033
summary = replaceUi5TagNames(summary);
3134
summary = summary.replaceAll('\n', '\n * ');

packages/main/src/webComponents/TableSelection/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ interface TableSelectionPropTypes
6161
*
6262
* @since [2.0.0](https://github.com/SAP/ui5-webcomponents/releases/tag/v2.0.0) of __@ui5/webcomponents__.
6363
* @experimental This web component is available since 2.0 with an experimental flag and its API and behavior are subject to change.
64-
*
65-
* @deprecated
64+
* @deprecated This component is deprecated and will be removed in future releases. Use the `TableSelectionSingle` or `TableSelectionMulti` components instead.
6665
*/
6766
const TableSelection = withWebComponent<TableSelectionPropTypes, TableSelectionDomRef>(
6867
'ui5-table-selection',

0 commit comments

Comments
 (0)