diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.test.tsx b/plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.test.tsx similarity index 96% rename from plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.test.tsx rename to plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.test.tsx index 681aea2c6f..63c06e778b 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.test.tsx +++ b/plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.test.tsx @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -jest.mock('./TemplateCard', () => ({ TemplateCard: jest.fn(() => null) })); +jest.mock('../TemplateCard', () => ({ TemplateCard: jest.fn(() => null) })); import React from 'react'; import { TemplateGroup } from './TemplateGroup'; import { render } from '@testing-library/react'; -import { TemplateCard } from '@backstage/plugin-scaffolder-react'; +import { TemplateCard } from '../TemplateCard'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; describe('TemplateGroup', () => { diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.tsx b/plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.tsx similarity index 95% rename from plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.tsx rename to plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.tsx index cd7e9bb6c4..b45d0947f4 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroup.tsx +++ b/plugins/scaffolder-react/src/next/components/TemplateGroup/TemplateGroup.tsx @@ -22,11 +22,8 @@ import { Link, } from '@backstage/core-components'; import { Typography } from '@material-ui/core'; -import { - TemplateCard, - TemplateCardProps, -} from '@backstage/plugin-scaffolder-react'; import { stringifyEntityRef } from '@backstage/catalog-model'; +import { TemplateCardProps, TemplateCard } from '../TemplateCard'; export interface TemplateGroupProps { templates: TemplateEntityV1beta3[]; diff --git a/plugins/scaffolder-react/src/next/components/TemplateGroup/index.ts b/plugins/scaffolder-react/src/next/components/TemplateGroup/index.ts new file mode 100644 index 0000000000..1515e12e45 --- /dev/null +++ b/plugins/scaffolder-react/src/next/components/TemplateGroup/index.ts @@ -0,0 +1,17 @@ +/* + * 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 { TemplateGroup } from './TemplateGroup'; diff --git a/plugins/scaffolder-react/src/next/components/index.ts b/plugins/scaffolder-react/src/next/components/index.ts index 0e3f7ce7fa..c710bd8891 100644 --- a/plugins/scaffolder-react/src/next/components/index.ts +++ b/plugins/scaffolder-react/src/next/components/index.ts @@ -16,3 +16,4 @@ export * from './Stepper'; export * from './TemplateCard'; export * from './ReviewState'; +export * from './TemplateGroup'; diff --git a/plugins/scaffolder-react/src/setupTests.ts b/plugins/scaffolder-react/src/setupTests.ts new file mode 100644 index 0000000000..326d2ed212 --- /dev/null +++ b/plugins/scaffolder-react/src/setupTests.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ +import '@testing-library/jest-dom'; diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx index 2d8cdc3150..4abdd79463 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx @@ -18,7 +18,7 @@ jest.mock('@backstage/plugin-catalog-react', () => ({ useEntityList: jest.fn(), })); -jest.mock('./TemplateGroup', () => ({ +jest.mock('@backstage/plugin-scaffolder-react', () => ({ TemplateGroup: jest.fn(() => null), })); @@ -28,7 +28,7 @@ import { useEntityList } from '@backstage/plugin-catalog-react'; import { TemplateGroups } from './TemplateGroups'; import { TestApiProvider } from '@backstage/test-utils'; import { errorApiRef } from '@backstage/core-plugin-api'; -import { TemplateGroup } from './TemplateGroup'; +import { TemplateGroup } from '@backstage/plugin-scaffolder-react'; describe('TemplateGroups', () => { it('should return progress if the hook is loading', async () => { diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx index f402c0ad19..e502bfd9a7 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx @@ -14,13 +14,14 @@ * limitations under the License. */ import React from 'react'; -import { TemplateGroup } from './TemplateGroup'; + import { Entity } from '@backstage/catalog-model'; import { useEntityList } from '@backstage/plugin-catalog-react'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { Progress, Link } from '@backstage/core-components'; import { Typography } from '@material-ui/core'; import { errorApiRef, useApi } from '@backstage/core-plugin-api'; +import { TemplateGroup } from '@backstage/plugin-scaffolder-react'; /** * @alpha diff --git a/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx b/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx index 2bb8eb5f8b..fed587b0ae 100644 --- a/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx +++ b/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx @@ -34,19 +34,17 @@ import { import { scaffolderApiRef } from '../../api'; import useAsync from 'react-use/lib/useAsync'; import { makeStyles } from '@material-ui/core'; -import { - Stepper, - NextFieldExtensionOptions, -} from '@backstage/plugin-scaffolder-react'; import { BackstageTheme } from '@backstage/theme'; import { nextRouteRef, scaffolderTaskRouteRef, selectedTemplateRouteRef, + Stepper, + NextFieldExtensionOptions, + type FormProps, } from '@backstage/plugin-scaffolder-react'; import { SecretsContext } from '../../components/secrets/SecretsContext'; import { JsonValue } from '@backstage/types'; -import type { FormProps } from '@backstage/plugin-scaffolder-react'; export type TemplateWizardPageProps = { customFieldExtensions: NextFieldExtensionOptions[];