Apply suggestions from code review
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
|
||||
Added a new optional `info` option to `createFrontendPlugin` that lets you provide a loaders for different sources of metadata information about the plugin.
|
||||
|
||||
There are two available loaders. The first one is `info.packageJson`, which can be used to point to a `package.json` file for the plugin.This is recommended for any plugin that is defined within its own package, especially all plugins that are published to a package registry. Typical usage looks like this:
|
||||
There are two available loaders. The first one is `info.packageJson`, which can be used to point to a `package.json` file for the plugin. This is recommended for any plugin that is defined within its own package, especially all plugins that are published to a package registry. Typical usage looks like this:
|
||||
|
||||
```ts
|
||||
export default createFrontendPlugin({
|
||||
pluginId: '...',
|
||||
info: {
|
||||
info: { packageJson: () => import('../package.json') },
|
||||
packageJson: () => import('../package.json'),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
The second loader is `info.manifest`, which can be used to point to an opaque plugin manifest. This **MUST ONLY** be used by plugins that intended for use within a single organization. Plugins that are published to an open package registry should **NOT** use this loader. The loader is useful to add additional internal metadata associated with the plugin, and it is up to the Backstage app to decide how these manifests are parsed and used. The default manifest parser in an app created with `createApp` from `@backstage/frontend-defaults` is able to parse the default `catalog-info.yaml` format and built-in fields such as `spec.owner`.
|
||||
The second loader is `info.manifest`, which can be used to point to an opaque plugin manifest. This **MUST ONLY** be used by plugins that are intended for use within a single organization. Plugins that are published to an open package registry should **NOT** use this loader. The loader is useful for adding additional internal metadata associated with the plugin, and it is up to the Backstage app to decide how these manifests are parsed and used. The default manifest parser in an app created with `createApp` from `@backstage/frontend-defaults` is able to parse the default `catalog-info.yaml` format and built-in fields such as `spec.owner`.
|
||||
|
||||
Typical usage looks like this:
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
'@backstage/frontend-app-api': patch
|
||||
---
|
||||
|
||||
Implemented support for the `plugin.info()` method in specialized apps with a default resolved for `package.json` and `catalog-info.yaml`. The default resolution logic can be overriden via the `pluginInfoResolver` option to `createSpecializedApp`, and plugin-specific overrides can be applied via the new `app.pluginOverrides` key in static configuration.
|
||||
Implemented support for the `plugin.info()` method in specialized apps with a default resolved for `package.json` and `catalog-info.yaml`. The default resolution logic can be overridden via the `pluginInfoResolver` option to `createSpecializedApp`, and plugin-specific overrides can be applied via the new `app.pluginOverrides` key in static configuration.
|
||||
|
||||
@@ -90,7 +90,7 @@ function normalizePluginInfo(info: FrontendPluginInfo) {
|
||||
ownerEntityRefs: info.ownerEntityRefs?.map(ref =>
|
||||
stringifyEntityRef(
|
||||
parseEntityRef(ref, {
|
||||
defaultKind: 'group',
|
||||
defaultKind: 'Group',
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -161,7 +161,7 @@ function resolveManifestInfo(manifest?: JsonValue) {
|
||||
info.ownerEntityRefs = [
|
||||
stringifyEntityRef(
|
||||
parseEntityRef(manifest.spec.owner, {
|
||||
defaultKind: 'group',
|
||||
defaultKind: 'Group',
|
||||
defaultNamespace: manifest.metadata.namespace?.toString(),
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -9,8 +9,8 @@ import { CreateAppRouteBinder } from '@backstage/frontend-app-api';
|
||||
import { ExtensionFactoryMiddleware } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeature } from '@backstage/frontend-plugin-api';
|
||||
import { FrontendFeatureLoader } from '@backstage/frontend-plugin-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { FrontendPluginInfoResolver } from '@backstage/frontend-app-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
// @public
|
||||
|
||||
Reference in New Issue
Block a user