>;
-
-// @public
-export type FormProps = Pick<
- FormProps_2,
- 'transformErrors' | 'noHtml5Validate'
->;
-
// @public
export type LayoutComponent<_TInputProps> = () => null;
@@ -150,7 +105,7 @@ export interface LayoutOptions {
// @public
export type LayoutTemplate = NonNullable<
- FormProps_2['uiSchema']
+ FormProps['uiSchema']
>['ui:ObjectFieldTemplate'];
// @public
@@ -169,64 +124,6 @@ export type LogEvent = {
taskId: string;
};
-// @alpha
-export type NextCustomFieldValidator = (
- data: TFieldReturnValue,
- field: FieldValidation_2,
- context: {
- apiHolder: ApiHolder;
- formData: JsonObject;
- schema: JsonObject;
- },
-) => void | Promise;
-
-// @alpha
-export interface NextFieldExtensionComponentProps<
- TFieldReturnValue,
- TUiOptions = {},
-> extends PropsWithChildren> {
- // (undocumented)
- uiSchema?: UiSchema & {
- 'ui:options'?: TUiOptions & UIOptionsType;
- };
-}
-
-// @alpha
-export type NextFieldExtensionOptions<
- TFieldReturnValue = unknown,
- TInputProps = unknown,
-> = {
- name: string;
- component: (
- props: NextFieldExtensionComponentProps,
- ) => JSX.Element | null;
- validation?: NextCustomFieldValidator;
- schema?: CustomFieldExtensionSchema;
-};
-
-// @alpha
-export interface ParsedTemplateSchema {
- // (undocumented)
- description?: string;
- // (undocumented)
- mergedSchema: JsonObject;
- // (undocumented)
- schema: JsonObject;
- // (undocumented)
- title: string;
- // (undocumented)
- uiSchema: UiSchema;
-}
-
-// @alpha
-export const ReviewState: (props: ReviewStateProps) => JSX.Element;
-
-// @alpha
-export type ReviewStateProps = {
- schemas: ParsedTemplateSchema[];
- formState: JsonObject;
-};
-
// @public
export interface ScaffolderApi {
// (undocumented)
@@ -380,66 +277,6 @@ export const SecretsContextProvider: ({
children,
}: PropsWithChildren<{}>) => JSX.Element;
-// @alpha
-export const Stepper: (stepperProps: StepperProps) => JSX.Element;
-
-// @alpha
-export type StepperProps = {
- manifest: TemplateParameterSchema;
- extensions: NextFieldExtensionOptions[];
- templateName?: string;
- FormProps?: FormProps;
- initialState?: Record;
- onCreate: (values: Record) => Promise;
- components?: {
- ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
- createButtonText?: ReactNode;
- reviewButtonText?: ReactNode;
- };
- layouts?: LayoutOptions[];
-};
-
-// @alpha
-export const TemplateCard: (props: TemplateCardProps) => JSX.Element;
-
-// @alpha
-export interface TemplateCardProps {
- // (undocumented)
- additionalLinks?: {
- icon: IconComponent;
- text: string;
- url: string;
- }[];
- // (undocumented)
- onSelected?: (template: TemplateEntityV1beta3) => void;
- // (undocumented)
- template: TemplateEntityV1beta3;
-}
-
-// @alpha
-export const TemplateGroup: (props: TemplateGroupProps) => JSX.Element;
-
-// @alpha
-export interface TemplateGroupProps {
- // (undocumented)
- components?: {
- CardComponent?: React_2.ComponentType;
- };
- // (undocumented)
- onSelected: (template: TemplateEntityV1beta3) => void;
- // (undocumented)
- templates: {
- template: TemplateEntityV1beta3;
- additionalLinks?: {
- icon: IconComponent;
- text: string;
- url: string;
- }[];
- }[];
- // (undocumented)
- title: React_2.ReactNode;
-}
-
// @public
export type TemplateParameterSchema = {
title: string;
@@ -463,45 +300,8 @@ export const useCustomLayouts: >(
outlet: React.ReactNode,
) => TComponentDataType[];
-// @alpha
-export const useFormDataFromQuery: (
- initialState?: Record,
-) => [Record, Dispatch>>];
-
-// @alpha (undocumented)
-export const useTemplateParameterSchema: (templateRef: string) => {
- manifest: TemplateParameterSchema | undefined;
- loading: boolean;
- error: Error | undefined;
-};
-
-// @alpha
-export const useTemplateSchema: (manifest: TemplateParameterSchema) => {
- steps: ParsedTemplateSchema[];
-};
-
// @public
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
-// @alpha (undocumented)
-export const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null;
-
-// @alpha (undocumented)
-export type WorkflowProps = {
- title?: string;
- description?: string;
- namespace: string;
- templateName: string;
- onError(error: Error | undefined): JSX.Element | null;
-} & Pick<
- StepperProps,
- | 'extensions'
- | 'FormProps'
- | 'components'
- | 'onCreate'
- | 'initialState'
- | 'layouts'
->;
-
// (No @packageDocumentation comment for this package)
```
diff --git a/plugins/scaffolder-react/package.json b/plugins/scaffolder-react/package.json
index 043c9d5ee2..4a4d94debf 100644
--- a/plugins/scaffolder-react/package.json
+++ b/plugins/scaffolder-react/package.json
@@ -6,10 +6,21 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
- "access": "public",
- "main": "dist/index.esm.js",
- "types": "dist/index.d.ts",
- "alphaTypes": "dist/index.alpha.d.ts"
+ "access": "public"
+ },
+ "exports": {
+ ".": "./src/index.ts",
+ "./alpha": "./src/alpha.ts"
+ },
+ "typesVersions": {
+ "*": {
+ "*": [
+ "src/index.ts"
+ ],
+ "alpha": [
+ "src/alpha.ts"
+ ]
+ }
},
"backstage": {
"role": "web-library"
@@ -24,7 +35,7 @@
"backstage"
],
"scripts": {
- "build": "backstage-cli package build --experimental-type-build",
+ "build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
@@ -80,7 +91,6 @@
"@testing-library/user-event": "^14.0.0"
},
"files": [
- "dist",
- "alpha"
+ "dist"
]
}
diff --git a/plugins/scaffolder-react/src/alpha.ts b/plugins/scaffolder-react/src/alpha.ts
new file mode 100644
index 0000000000..731b8e07d9
--- /dev/null
+++ b/plugins/scaffolder-react/src/alpha.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2022 The Backstage Authors
+ *
+ * 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.
+ */
+
+export * from './next';
+export type { FormProps } from './next';
diff --git a/plugins/scaffolder-react/src/index.ts b/plugins/scaffolder-react/src/index.ts
index 67703e3ed1..1b20c19414 100644
--- a/plugins/scaffolder-react/src/index.ts
+++ b/plugins/scaffolder-react/src/index.ts
@@ -20,5 +20,3 @@ export * from './secrets';
export * from './api';
export * from './hooks';
export * from './layouts';
-
-export * from './next';
diff --git a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx
index bb2844fd52..444e463064 100644
--- a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx
+++ b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx
@@ -26,7 +26,7 @@ import { type IChangeEvent } from '@rjsf/core-v5';
import { ErrorSchema } from '@rjsf/utils';
import React, { useCallback, useMemo, useState, type ReactNode } from 'react';
import { NextFieldExtensionOptions } from '../../extensions';
-import { TemplateParameterSchema } from '../../../types';
+import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
import {
createAsyncValidators,
type FormValidation,
@@ -36,7 +36,7 @@ import { useTemplateSchema } from '../../hooks/useTemplateSchema';
import validator from '@rjsf/validator-ajv8';
import { useFormDataFromQuery } from '../../hooks';
import { FormProps } from '../../types';
-import { LayoutOptions } from '../../../layouts';
+import { LayoutOptions } from '@backstage/plugin-scaffolder-react';
import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';
import { hasErrors } from './utils';
import * as FieldOverrides from './FieldOverrides';
diff --git a/plugins/scaffolder-react/src/next/extensions/index.tsx b/plugins/scaffolder-react/src/next/extensions/index.tsx
index ee9b1cd326..b2d402c93f 100644
--- a/plugins/scaffolder-react/src/next/extensions/index.tsx
+++ b/plugins/scaffolder-react/src/next/extensions/index.tsx
@@ -21,7 +21,8 @@ import {
} from './types';
import { Extension, attachComponentData } from '@backstage/core-plugin-api';
import { UIOptionsType } from '@rjsf/utils';
-import { FieldExtensionComponent } from '../../extensions';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react';
import { FIELD_EXTENSION_KEY } from '../../extensions/keys';
/**
diff --git a/plugins/scaffolder-react/src/next/extensions/types.ts b/plugins/scaffolder-react/src/next/extensions/types.ts
index 1e4c671511..0917efe85d 100644
--- a/plugins/scaffolder-react/src/next/extensions/types.ts
+++ b/plugins/scaffolder-react/src/next/extensions/types.ts
@@ -22,7 +22,7 @@ import {
} from '@rjsf/utils';
import { PropsWithChildren } from 'react';
import { JsonObject } from '@backstage/types';
-import { CustomFieldExtensionSchema } from '../../extensions';
+import { CustomFieldExtensionSchema } from '@backstage/plugin-scaffolder-react';
/**
* Type for Field Extension Props for RJSF v5
diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts b/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts
index 36b8b1e0bc..d060b9a09f 100644
--- a/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts
+++ b/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts
@@ -1,5 +1,3 @@
-import { useApi } from '@backstage/core-plugin-api';
-
/*
* Copyright 2023 The Backstage Authors
*
@@ -15,8 +13,11 @@ import { useApi } from '@backstage/core-plugin-api';
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
import useAsync from 'react-use/lib/useAsync';
import { scaffolderApiRef } from '../../api/ref';
+import { useApi } from '@backstage/core-plugin-api';
+import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
/**
* @alpha
@@ -28,5 +29,5 @@ export const useTemplateParameterSchema = (templateRef: string) => {
[scaffolderApi, templateRef],
);
- return { manifest: value, loading, error };
+ return { manifest: value as TemplateParameterSchema, loading, error };
};
diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx
index 153c48468d..ab33652338 100644
--- a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx
+++ b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx
@@ -18,7 +18,7 @@ import { renderHook } from '@testing-library/react-hooks';
import { TestApiProvider } from '@backstage/test-utils';
import React from 'react';
import { featureFlagsApiRef } from '@backstage/core-plugin-api';
-import { TemplateParameterSchema } from '../../types';
+import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
describe('useTemplateSchema', () => {
it('should generate the correct schema', () => {
diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts
index 2b2e48cf68..26980b15cf 100644
--- a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts
+++ b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts
@@ -16,7 +16,7 @@
import { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { UiSchema } from '@rjsf/utils';
-import { TemplateParameterSchema } from '../../types';
+import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react';
import { extractSchemaFromStep } from '../lib';
/**
diff --git a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts
index 881c4f90c5..612ad5427b 100644
--- a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts
+++ b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { type ParsedTemplateSchema } from './useTemplateSchema';
-import { type LayoutOptions } from '../../layouts';
+import { type LayoutOptions } from '@backstage/plugin-scaffolder-react';
interface Options {
layouts?: LayoutOptions[];
diff --git a/plugins/scaffolder-react/src/next/types.ts b/plugins/scaffolder-react/src/next/types.ts
index 54a64a5323..192fdf4146 100644
--- a/plugins/scaffolder-react/src/next/types.ts
+++ b/plugins/scaffolder-react/src/next/types.ts
@@ -23,7 +23,7 @@ import type { FormProps as SchemaFormProps } from '@rjsf/core-v5';
/**
* Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
*
- * @public
+ * @alpha
*/
export type FormProps = Pick<
SchemaFormProps,