diff --git a/packages/core-api/src/extensions/extensions.tsx b/packages/core-api/src/extensions/extensions.tsx index 9f6412f960..d16f24c229 100644 --- a/packages/core-api/src/extensions/extensions.tsx +++ b/packages/core-api/src/extensions/extensions.tsx @@ -20,7 +20,7 @@ import { BackstagePlugin, Extension } from '../plugin/types'; import { RouteRef, useRouteRef } from '../routing'; import { attachComponentData } from './componentData'; -type ComponentLoader = +export type ComponentLoader = | { lazy: () => Promise; } diff --git a/packages/core-api/src/extensions/index.ts b/packages/core-api/src/extensions/index.ts index 26a0c597b1..2f80b1c42c 100644 --- a/packages/core-api/src/extensions/index.ts +++ b/packages/core-api/src/extensions/index.ts @@ -20,3 +20,4 @@ export { createRoutableExtension, createComponentExtension, } from './extensions'; +export type { ComponentLoader } from './extensions'; diff --git a/plugins/scaffolder/src/extensions/index.tsx b/plugins/scaffolder/src/extensions/index.tsx new file mode 100644 index 0000000000..71d762739d --- /dev/null +++ b/plugins/scaffolder/src/extensions/index.tsx @@ -0,0 +1,25 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Extension, ComponentLoader } from '@backstage/core'; + +export type FormExtensionOptions = { + name: string; + component: ComponentLoader; +}; + +export function createScaffolderFormExtension< + T extends (props: any) => JSX.Element | null +>(options: FormExtensionOptions): Extension {}