Skip to content

feat(cli): add deprecation notice of components in wrapper script #7178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/cli/src/scripts/create-wrappers/ComponentRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ export class ComponentRenderer extends AbstractRenderer {
private attributes: CEM.ClassField[] = [];
private slots: CEM.Slot[] = [];
private events: CEM.Event[] = [];
private description: string = '';
private description: CEM.ClassLike['description'] = '';
private note: string = '';
private isAbstract: boolean = false;
private since: string | undefined;
private isExperimental: boolean | string | undefined = false;
private since: CEM.ClassLike['_ui5since'];
private isExperimental: CEM.ClassLike['_ui5experimental'] = false;
private isDeprecated: CEM.ClassLike['deprecated'];

setAttributes(attrs: CEM.ClassField[]) {
this.attributes.push(...attrs);
Expand Down Expand Up @@ -56,6 +57,11 @@ export class ComponentRenderer extends AbstractRenderer {
return this;
}

setIsDeprecated(value?: CEM.ClassField['deprecated']) {
this.isDeprecated = value;
return this;
}

prepare(context: WebComponentWrapper) {
context.exportSet.add(context.componentName);
}
Expand All @@ -77,6 +83,10 @@ export class ComponentRenderer extends AbstractRenderer {
comment += ` * @experimental${typeof this.isExperimental === 'string' ? ` ${this.isExperimental}` : ''}\n`;
}

if (this.isDeprecated) {
comment += ` * @deprecated${typeof this.isDeprecated === 'string' ? ` ${summaryFormatter(this.isDeprecated)}` : ''}\n`;
}

comment += '*/';

const component = dedent`
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/scripts/create-wrappers/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default async function createWrappers(packageName: string, outDir: string
.setIsAbstract(declaration._ui5abstract ?? false)
.setSince(declaration._ui5since)
.setIsExperimental(declaration._ui5experimental)
.setIsDeprecated(declaration.deprecated)
);
wrapper.addRenderer(new ExportsRenderer());

Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/util/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export function propDescriptionFormatter(html: string) {
return replaceUi5TagNames(html).replaceAll('\n', '\n * ');
}

export function summaryFormatter(htmlDesc: string) {
export function summaryFormatter(htmlDesc: string | undefined) {
if (!htmlDesc) {
return '';
}
let summary = htmlDesc.replace(/###\s?Overview\n*/, '').replace(/### ES6 Module Import\n*`.+`/, '');
summary = replaceUi5TagNames(summary);
summary = summary.replaceAll('\n', '\n * ');
Expand Down
3 changes: 1 addition & 2 deletions packages/main/src/webComponents/TableSelection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ interface TableSelectionPropTypes
*
* @since [2.0.0](https://github.com/SAP/ui5-webcomponents/releases/tag/v2.0.0) of __@ui5/webcomponents__.
* @experimental This web component is available since 2.0 with an experimental flag and its API and behavior are subject to change.
*
* @deprecated
* @deprecated This component is deprecated and will be removed in future releases. Use the `TableSelectionSingle` or `TableSelectionMulti` components instead.
*/
const TableSelection = withWebComponent<TableSelectionPropTypes, TableSelectionDomRef>(
'ui5-table-selection',
Expand Down
Loading