Skip to content
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

fix(npm): export deprecated card components to be backward compatible #1751

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions workspaces/npm/.changeset/violet-foxes-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-npm': patch
---

export deprecated card components to be backward compatible
9 changes: 9 additions & 0 deletions workspaces/npm/plugins/npm/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const EntityNpmReleaseTableCard: () => JSX_2.Element;
// @public
export const isNpmAvailable: (entity: Entity) => boolean;

// @public @deprecated (undocumented)
export const NpmInfoCard: () => JSX_2.Element;

// @public
export const npmPlugin: BackstagePlugin<
{
Expand All @@ -30,4 +33,10 @@ export const npmPlugin: BackstagePlugin<
{},
{}
>;

// @public @deprecated (undocumented)
export const NpmReleaseOverviewCard: () => JSX_2.Element;

// @public @deprecated (undocumented)
export const NpmReleaseTableCard: () => JSX_2.Element;
```
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ function GridItem({
* name, description, keywords, license, some links and
* the latest version if available.
*
* @public
*/
export const NpmInfoCard = () => {
export const EntityNpmInfoCard = () => {
const { entity } = useEntity();

const packageName = entity.metadata.annotations?.[NPM_PACKAGE_ANNOTATION];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ const tagColumns: TableColumn<TagRow>[] = [
* Card for the catalog (entiy page) that shows the latest tags
* with their version number and the release date.
*
* @public
*/
export const NpmReleaseOverviewCard = () => {
export const EntityNpmReleaseOverviewCard = () => {
const { entity } = useEntity();

const packageName = entity.metadata.annotations?.[NPM_PACKAGE_ANNOTATION];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ const columns: TableColumn<TableData>[] = [
* One for the latest tags and versions of a npm package.
* And another one for the complete version history.
*
* @public
*/
export const NpmReleaseTableCard = () => {
export const EntityNpmReleaseTableCard = () => {
const { entity } = useEntity();

const packageName = entity.metadata.annotations?.[NPM_PACKAGE_ANNOTATION];
Expand Down
18 changes: 0 additions & 18 deletions workspaces/npm/plugins/npm/src/components/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions workspaces/npm/plugins/npm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export {
EntityNpmInfoCard,
EntityNpmReleaseOverviewCard,
EntityNpmReleaseTableCard,
NpmInfoCard,
NpmReleaseOverviewCard,
NpmReleaseTableCard,
} from './plugin';

export { isNpmAvailable } from './utils/isNpmAvailable';
33 changes: 26 additions & 7 deletions workspaces/npm/plugins/npm/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,28 @@ export const npmPlugin = createPlugin({
* Page content for the catalog (entiy page) that shows two tables.
* One for the latest tags and versions of a npm package.
* And another one for the complete version history.
* @public
*
* @public
*/
export const EntityNpmReleaseTableCard = npmPlugin.provide(
createComponentExtension({
name: 'EntityNpmReleaseTableCard',
component: {
lazy: () =>
import('./components/NpmReleaseTableCard').then(
m => m.NpmReleaseTableCard,
import('./components/EntityNpmReleaseTableCard').then(
m => m.EntityNpmReleaseTableCard,
),
},
}),
);

/**
*
* @deprecated please use `EntityNpmReleaseTableCard` instead.
* @public
*/
export const NpmReleaseTableCard = EntityNpmReleaseTableCard;

/**
* Card for the catalog (entity page) that shows the npm
* name, description, keywords, license, some links and
* the latest version if available.
Expand All @@ -62,11 +68,18 @@ export const EntityNpmInfoCard = npmPlugin.provide(
createComponentExtension({
name: 'EntityNpmInfoCard',
component: {
lazy: () => import('./components/NpmInfoCard').then(m => m.NpmInfoCard),
lazy: () =>
import('./components/EntityNpmInfoCard').then(m => m.EntityNpmInfoCard),
},
}),
);

/**
* @deprecated please use `EntityNpmInfoCard` instead.
* @public
*/
export const NpmInfoCard = EntityNpmInfoCard;

/**
* Card for the catalog (entiy page) that shows the latest tags
* with their version number and the release date.
Expand All @@ -78,9 +91,15 @@ export const EntityNpmReleaseOverviewCard = npmPlugin.provide(
name: 'EntityNpmReleaseOverviewCard',
component: {
lazy: () =>
import('./components/NpmReleaseOverviewCard').then(
m => m.NpmReleaseOverviewCard,
import('./components/EntityNpmReleaseOverviewCard').then(
m => m.EntityNpmReleaseOverviewCard,
),
},
}),
);

/**
* @deprecated please use `EntityNpmReleaseOverviewCard` instead.
* @public
*/
export const NpmReleaseOverviewCard = EntityNpmReleaseOverviewCard;
Loading