code-coverage: clean up exports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
'@backstage/plugin-code-coverage': minor
|
||||
---
|
||||
|
||||
Cleaned up API exports.
|
||||
|
||||
The `Router` export has been removed; users are expected to use `EntityCodeCoverageContent` instead.
|
||||
|
||||
The `isPluginApplicableToEntity` helper has been deprecated, in favor of the `isCodeCoverageAvailable` helper.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-code-coverage-backend': minor
|
||||
---
|
||||
|
||||
Cleaned up API exports.
|
||||
|
||||
The `CodeCoverageApi` and `makeRouter` exports have been removed from the backend, since they were not meant to be exported in the first place.
|
||||
@@ -10,27 +10,10 @@ import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CodeCoverageApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface CodeCoverageApi {
|
||||
// (undocumented)
|
||||
name: string;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "makeRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const makeRouter: (options: RouterOptions) => Promise<express.Router>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
|
||||
@@ -20,4 +20,5 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './service/router';
|
||||
export { createRouter } from './service/router';
|
||||
export type { RouterOptions } from './service/router';
|
||||
|
||||
@@ -35,6 +35,11 @@ import { Jacoco } from './converter/jacoco';
|
||||
import { Converter } from './converter';
|
||||
import { getEntitySourceLocation } from '@backstage/catalog-model';
|
||||
|
||||
/**
|
||||
* Options for {@link createRouter}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface RouterOptions {
|
||||
config: Config;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
@@ -211,6 +216,11 @@ export const makeRouter = async (
|
||||
return router;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a code-coverage plugin backend router.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export async function createRouter(
|
||||
options: RouterOptions,
|
||||
): Promise<express.Router> {
|
||||
|
||||
@@ -9,8 +9,6 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "codeCoveragePlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const codeCoveragePlugin: BackstagePlugin<
|
||||
{
|
||||
@@ -19,20 +17,12 @@ export const codeCoveragePlugin: BackstagePlugin<
|
||||
{}
|
||||
>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "EntityCodeCoverageContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export const EntityCodeCoverageContent: () => JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "isCodeCoverageAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
const isCodeCoverageAvailable: (entity: Entity) => boolean;
|
||||
export { isCodeCoverageAvailable };
|
||||
export { isCodeCoverageAvailable as isPluginApplicableToEntity };
|
||||
// @public
|
||||
export function isCodeCoverageAvailable(entity: Entity): boolean;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const Router: () => JSX.Element;
|
||||
// @public @deprecated (undocumented)
|
||||
export const isPluginApplicableToEntity: typeof isCodeCoverageAvailable;
|
||||
```
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'highlight.js/styles/atom-one-dark.css';
|
||||
import highlight from 'highlight.js';
|
||||
|
||||
|
||||
@@ -13,16 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { CodeCoveragePage } from './CodeCoveragePage';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
|
||||
export const isCodeCoverageAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.['backstage.io/code-coverage']);
|
||||
/**
|
||||
* Returns true if the given entity has code coverage enabled.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function isCodeCoverageAvailable(entity: Entity) {
|
||||
return Boolean(entity.metadata.annotations?.['backstage.io/code-coverage']);
|
||||
}
|
||||
|
||||
export const Router = () => {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const Router = (): JSX.Element => {
|
||||
const { entity } = useEntity();
|
||||
|
||||
if (!isCodeCoverageAvailable(entity)) {
|
||||
@@ -30,5 +40,6 @@ export const Router = () => {
|
||||
<MissingAnnotationEmptyState annotation="backstage.io/code-coverage" />
|
||||
);
|
||||
}
|
||||
|
||||
return <CodeCoveragePage />;
|
||||
};
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
import { isCodeCoverageAvailable } from './components/Router';
|
||||
|
||||
export { codeCoveragePlugin, EntityCodeCoverageContent } from './plugin';
|
||||
export {
|
||||
Router,
|
||||
isCodeCoverageAvailable,
|
||||
isCodeCoverageAvailable as isPluginApplicableToEntity,
|
||||
} from './components/Router';
|
||||
export { isCodeCoverageAvailable };
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Use `isPluginApplicableToEntity` instead.
|
||||
*/
|
||||
export const isPluginApplicableToEntity = isCodeCoverageAvailable;
|
||||
|
||||
@@ -23,6 +23,9 @@ import {
|
||||
discoveryApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const codeCoveragePlugin = createPlugin({
|
||||
id: 'code-coverage',
|
||||
routes: {
|
||||
@@ -37,6 +40,11 @@ export const codeCoveragePlugin = createPlugin({
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* An entity code coverage page.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const EntityCodeCoverageContent = codeCoveragePlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'EntityCodeCoverageContent',
|
||||
|
||||
@@ -219,8 +219,6 @@ const ALLOW_WARNINGS = [
|
||||
'plugins/circleci',
|
||||
'plugins/cloudbuild',
|
||||
'plugins/code-climate',
|
||||
'plugins/code-coverage',
|
||||
'plugins/code-coverage-backend',
|
||||
'plugins/config-schema',
|
||||
'plugins/cost-insights',
|
||||
'plugins/dynatrace',
|
||||
|
||||
Reference in New Issue
Block a user