Skip to content

Commit

Permalink
make npm plugin public
Browse files Browse the repository at this point in the history
Signed-off-by: Karthik Jeeyar <[email protected]>
  • Loading branch information
karthikjeeyar committed Oct 22, 2024
1 parent 42eab2c commit 5643b77
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
5 changes: 2 additions & 3 deletions workspaces/npm/plugins/npm/dev/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import { npmPlugin, NpmReleases } from '../src/plugin';
import { npmPlugin, NpmInfoCard, NpmReleaseTableCard } from '../src/plugin';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { NpmInfoCard } from '../src/components/NpmInfoCard';
import { Content, Header, Page } from '@backstage/core-components';
import { Grid } from '@material-ui/core';

Expand Down Expand Up @@ -46,7 +45,7 @@ createDevApp()
<EntityProvider entity={mockEntity}>
<Grid container>
<Grid item xs={8}>
<NpmReleases />
<NpmReleaseTableCard />
</Grid>
<Grid item xs={4}>
<NpmInfoCard />
Expand Down
3 changes: 2 additions & 1 deletion workspaces/npm/plugins/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"homepage": "https://github.com/backstage/community-plugins/tree/main/workspaces/npm/plugins/npm",
"bugs": "https://github.com/backstage/community-plugins/issues",
"maintainers": [
"jerolimov"
"jerolimov",
"karthikjeeyar"
],
"author": "Christoph Jerolimov"
}
8 changes: 5 additions & 3 deletions workspaces/npm/plugins/npm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
export { npmPlugin } from './plugin';

export { isNpmAvailable } from './utils/isNpmAvailable';
export { NpmInfoCard } from './components/NpmInfoCard';
export { NpmReleaseOverviewCard } from './components/NpmReleaseOverviewCard';
export { NpmReleaseTableCard } from './components/NpmReleaseTableCard';
export {
NpmInfoCard,
NpmReleaseOverviewCard,
NpmReleaseTableCard,
} from './plugin';
42 changes: 33 additions & 9 deletions workspaces/npm/plugins/npm/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/
import {
createComponentExtension,
createPlugin,
createRoutableExtension,
} from '@backstage/core-plugin-api';

import { rootRouteRef } from './routes';
Expand All @@ -33,13 +33,37 @@ export const npmPlugin = createPlugin({
});

/** @public */
export const NpmReleases = npmPlugin.provide(
createRoutableExtension({
name: 'NpmReleasesTable',
component: () =>
import('./components/NpmReleaseTableCard').then(
m => m.NpmReleaseTableCard,
),
mountPoint: rootRouteRef,
export const NpmReleaseTableCard = npmPlugin.provide(
createComponentExtension({
name: 'NpmReleaseTableCard',
component: {
lazy: () =>
import('./components/NpmReleaseTableCard').then(
m => m.NpmReleaseTableCard,
),
},
}),
);

/** @public */
export const NpmInfoCard = npmPlugin.provide(
createComponentExtension({
name: 'NpmInfoCard',
component: {
lazy: () => import('./components/NpmInfoCard').then(m => m.NpmInfoCard),
},
}),
);

/** @public */
export const NpmReleaseOverviewCard = npmPlugin.provide(
createComponentExtension({
name: 'NpmReleaseOverviewCard',
component: {
lazy: () =>
import('./components/NpmReleaseOverviewCard').then(
m => m.NpmReleaseOverviewCard,
),
},
}),
);

0 comments on commit 5643b77

Please sign in to comment.