frontend-plugin-api: renamed createPlugin to createFrontendPlugin
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
import {
|
||||
createRouteRef,
|
||||
createExternalRouteRef,
|
||||
createPlugin,
|
||||
createFrontendPlugin,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { collectRouteIds } from './collectRouteIds';
|
||||
|
||||
@@ -34,7 +34,11 @@ describe('collectRouteIds', () => {
|
||||
);
|
||||
|
||||
const collected = collectRouteIds([
|
||||
createPlugin({ id: 'test', routes: { ref }, externalRoutes: { extRef } }),
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
routes: { ref },
|
||||
externalRoutes: { extRef },
|
||||
}),
|
||||
]);
|
||||
expect(Object.fromEntries(collected.routes)).toEqual({
|
||||
'test.ref': ref,
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
coreExtensionData,
|
||||
createExtension,
|
||||
createExtensionInput,
|
||||
createPlugin,
|
||||
createFrontendPlugin,
|
||||
createRouteRef,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { MockConfigApi } from '@backstage/test-utils';
|
||||
@@ -71,7 +71,7 @@ function createTestExtension(options: {
|
||||
}
|
||||
|
||||
function routeInfoFromExtensions(extensions: ExtensionDefinition<any, any>[]) {
|
||||
const plugin = createPlugin({
|
||||
const plugin = createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions,
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import {
|
||||
createExtension,
|
||||
createExtensionOverrides,
|
||||
createPlugin,
|
||||
createFrontendPlugin,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { MockConfigApi } from '@backstage/test-utils';
|
||||
import { createAppTree } from './createAppTree';
|
||||
@@ -41,7 +41,7 @@ describe('createAppTree', () => {
|
||||
},
|
||||
});
|
||||
const features = [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'plugin',
|
||||
extensions: [],
|
||||
}),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import {
|
||||
createExtensionOverrides,
|
||||
createPlugin,
|
||||
createFrontendPlugin,
|
||||
Extension,
|
||||
ExtensionDefinition,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
@@ -98,7 +98,10 @@ describe('resolveAppNodeSpecs', () => {
|
||||
|
||||
it('should override attachment points', () => {
|
||||
const b = makeExt('b');
|
||||
const pluginA = createPlugin({ id: 'test', extensions: [makeExtDef('a')] });
|
||||
const pluginA = createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [makeExtDef('a')],
|
||||
});
|
||||
expect(
|
||||
resolveAppNodeSpecs({
|
||||
features: [pluginA],
|
||||
@@ -130,7 +133,7 @@ describe('resolveAppNodeSpecs', () => {
|
||||
it('should fully override configuration and duplicate', () => {
|
||||
const a = makeExt('test/a');
|
||||
const b = makeExt('test/b');
|
||||
const plugin = createPlugin({
|
||||
const plugin = createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [makeExtDef('a'), makeExtDef('b')],
|
||||
});
|
||||
@@ -178,7 +181,7 @@ describe('resolveAppNodeSpecs', () => {
|
||||
const b = makeExt('b', 'disabled');
|
||||
expect(
|
||||
resolveAppNodeSpecs({
|
||||
features: [createPlugin({ id: 'empty', extensions: [] })],
|
||||
features: [createFrontendPlugin({ id: 'empty', extensions: [] })],
|
||||
builtinExtensions: [a, b],
|
||||
parameters: [
|
||||
{
|
||||
@@ -217,7 +220,7 @@ describe('resolveAppNodeSpecs', () => {
|
||||
const g = makeExt('g', 'disabled');
|
||||
expect(
|
||||
resolveAppNodeSpecs({
|
||||
features: [createPlugin({ id: 'empty', extensions: [] })],
|
||||
features: [createFrontendPlugin({ id: 'empty', extensions: [] })],
|
||||
builtinExtensions: [a, b, c, d, e, f, g],
|
||||
parameters: [
|
||||
{ id: 'e', disabled: false },
|
||||
@@ -272,7 +275,7 @@ describe('resolveAppNodeSpecs', () => {
|
||||
});
|
||||
|
||||
it('should apply extension overrides', () => {
|
||||
const plugin = createPlugin({
|
||||
const plugin = createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [makeExtDef('a'), makeExtDef('b')],
|
||||
});
|
||||
@@ -323,7 +326,7 @@ describe('resolveAppNodeSpecs', () => {
|
||||
it('should use order from configuration when rather than overrides', () => {
|
||||
const result = resolveAppNodeSpecs({
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [
|
||||
makeExtDef('a', 'disabled'),
|
||||
@@ -357,7 +360,10 @@ describe('resolveAppNodeSpecs', () => {
|
||||
expect(() =>
|
||||
resolveAppNodeSpecs({
|
||||
features: [
|
||||
createPlugin({ id: 'test', extensions: [makeExtDef('forbidden')] }),
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [makeExtDef('forbidden')],
|
||||
}),
|
||||
],
|
||||
builtinExtensions: [],
|
||||
parameters: [],
|
||||
|
||||
@@ -25,7 +25,7 @@ import { toInternalExtensionOverrides } from '../../../frontend-plugin-api/src/w
|
||||
import { ExtensionParameters } from './readAppExtensionsConfig';
|
||||
import { AppNodeSpec } from '@backstage/frontend-plugin-api';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalBackstagePlugin } from '../../../frontend-plugin-api/src/wiring/createPlugin';
|
||||
import { toInternalBackstagePlugin } from '../../../frontend-plugin-api/src/wiring/createFrontendPlugin';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalExtension } from '../../../frontend-plugin-api/src/wiring/resolveExtensionDefinition';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
createExtension,
|
||||
createExtensionOverrides,
|
||||
createPageExtension,
|
||||
createPlugin,
|
||||
createFrontendPlugin,
|
||||
createThemeExtension,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
@@ -44,7 +44,7 @@ describe('createApp', () => {
|
||||
}),
|
||||
}),
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [
|
||||
createThemeExtension({
|
||||
@@ -68,7 +68,7 @@ describe('createApp', () => {
|
||||
const app = createApp({
|
||||
configLoader: async () => ({ config: new MockConfigApi({}) }),
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: duplicatedFeatureId,
|
||||
extensions: [
|
||||
createPageExtension({
|
||||
@@ -77,7 +77,7 @@ describe('createApp', () => {
|
||||
}),
|
||||
],
|
||||
}),
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: duplicatedFeatureId,
|
||||
extensions: [
|
||||
createPageExtension({
|
||||
@@ -107,7 +107,7 @@ describe('createApp', () => {
|
||||
async load({ config }) {
|
||||
return {
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
extensions: [
|
||||
createPageExtension({
|
||||
@@ -163,7 +163,7 @@ describe('createApp', () => {
|
||||
const app = createApp({
|
||||
configLoader: async () => ({ config: new MockConfigApi({}) }),
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'test',
|
||||
featureFlags: [{ name: 'test-1' }],
|
||||
extensions: [
|
||||
@@ -218,7 +218,7 @@ describe('createApp', () => {
|
||||
const app = createApp({
|
||||
configLoader: async () => ({ config: new MockConfigApi({}) }),
|
||||
features: [
|
||||
createPlugin({
|
||||
createFrontendPlugin({
|
||||
id: 'my-plugin',
|
||||
extensions: [
|
||||
createPageExtension({
|
||||
|
||||
@@ -100,7 +100,7 @@ import {
|
||||
import { InternalAppContext } from './InternalAppContext';
|
||||
import { AppRoot } from '../extensions/AppRoot';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalBackstagePlugin } from '../../../frontend-plugin-api/src/wiring/createPlugin';
|
||||
import { toInternalBackstagePlugin } from '../../../frontend-plugin-api/src/wiring/createFrontendPlugin';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import { toInternalExtensionOverrides } from '../../../frontend-plugin-api/src/wiring/createExtensionOverrides';
|
||||
import { DefaultComponentsApi } from '../apis/implementations/ComponentsApi';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createPlugin } from '@backstage/frontend-plugin-api';
|
||||
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
||||
import { getAvailableFeatures } from './discovery';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('getAvailableFeatures', () => {
|
||||
});
|
||||
|
||||
it('should discover a plugin', () => {
|
||||
const testPlugin = createPlugin({ id: 'test' });
|
||||
const testPlugin = createFrontendPlugin({ id: 'test' });
|
||||
globalSpy.mockReturnValue({
|
||||
modules: [{ default: testPlugin }],
|
||||
});
|
||||
@@ -67,9 +67,9 @@ describe('getAvailableFeatures', () => {
|
||||
});
|
||||
|
||||
it('should discover multiple plugins', () => {
|
||||
const test1Plugin = createPlugin({ id: 'test1' });
|
||||
const test2Plugin = createPlugin({ id: 'test2' });
|
||||
const test3Plugin = createPlugin({ id: 'test3' });
|
||||
const test1Plugin = createFrontendPlugin({ id: 'test1' });
|
||||
const test2Plugin = createFrontendPlugin({ id: 'test2' });
|
||||
const test3Plugin = createFrontendPlugin({ id: 'test3' });
|
||||
globalSpy.mockReturnValue({
|
||||
modules: [
|
||||
{ default: test1Plugin },
|
||||
|
||||
Reference in New Issue
Block a user