apply core-imports codemod to all packages and plugins

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-06-17 17:56:24 +02:00
parent 9b9a8f3925
commit d453c05dc3
541 changed files with 1549 additions and 1321 deletions
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor, getByText } from '@testing-library/react';
import React from 'react';
import { DefaultExplorePage } from './DefaultExplorePage';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
describe('<DefaultExplorePage />', () => {
const catalogApi: jest.Mocked<typeof catalogApiRef.T> = {
@@ -15,11 +15,11 @@
*/
import React from 'react';
import { configApiRef, useApi } from '@backstage/core';
import { DomainExplorerContent } from '../DomainExplorerContent';
import { ExploreLayout } from '../ExploreLayout';
import { GroupsExplorerContent } from '../GroupsExplorerContent';
import { ToolExplorerContent } from '../ToolExplorerContent';
import { configApiRef, useApi } from '@backstage/core-plugin-api';
export const DefaultExplorePage = () => {
const configApi = useApi(configApiRef);
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { DomainEntity, RELATION_OWNED_BY } from '@backstage/catalog-model';
import { Button, ItemCardHeader, useRouteRef } from '@backstage/core';
import {
EntityRefLinks,
entityRouteParams,
@@ -31,6 +30,9 @@ import {
import React from 'react';
import { catalogEntityRouteRef } from '../../routes';
import { Button, ItemCardHeader } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
type DomainCardProps = {
entity: DomainEntity;
};
@@ -15,13 +15,13 @@
*/
import { DomainEntity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { catalogEntityRouteRef } from '../../routes';
import { DomainExplorerContent } from './DomainExplorerContent';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
describe('<DomainExplorerContent />', () => {
const catalogApi: jest.Mocked<typeof catalogApiRef.T> = {
@@ -14,6 +14,12 @@
* limitations under the License.
*/
import { DomainEntity } from '@backstage/catalog-model';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { Button } from '@material-ui/core';
import React from 'react';
import { useAsync } from 'react-use';
import { DomainCard } from '../DomainCard';
import {
Content,
ContentHeader,
@@ -21,14 +27,10 @@ import {
ItemCardGrid,
Progress,
SupportButton,
useApi,
WarningPanel,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import { Button } from '@material-ui/core';
import React from 'react';
import { useAsync } from 'react-use';
import { DomainCard } from '../DomainCard';
} from '@backstage/core-components';
import { useApi } from '@backstage/core-plugin-api';
const Body = () => {
const catalogApi = useApi(catalogApiRef);
@@ -14,10 +14,12 @@
* limitations under the License.
*/
import { attachComponentData, Header, Page, RoutedTabs } from '@backstage/core';
import { TabProps } from '@material-ui/core';
import { Children, default as React, Fragment, isValidElement } from 'react';
import { attachComponentData } from '@backstage/core-plugin-api';
import { Header, Page, RoutedTabs } from '@backstage/core-components';
// TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts
// A generalized version of createSubRoutesFromChildren, etc. would be required
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { ApiProvider, ApiRegistry } from '@backstage/core';
import {
catalogApiRef,
CatalogApi,
@@ -24,6 +23,7 @@ import { Entity } from '@backstage/catalog-model';
import { renderInTestApp } from '@backstage/test-utils';
import React from 'react';
import { GroupsDiagram } from './GroupsDiagram';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
describe('<GroupsDiagram />', () => {
beforeAll(() => {
@@ -25,22 +25,21 @@ import {
getEntityRelations,
formatEntityRefTitle,
} from '@backstage/plugin-catalog-react';
import {
DependencyGraph,
DependencyGraphTypes,
Progress,
useApi,
ResponseErrorPanel,
Link,
useRouteRef,
configApiRef,
} from '@backstage/core';
import { makeStyles, Typography } from '@material-ui/core';
import ZoomOutMap from '@material-ui/icons/ZoomOutMap';
import React from 'react';
import { useAsync } from 'react-use';
import { BackstageTheme } from '@backstage/theme';
import {
DependencyGraph,
DependencyGraphTypes,
Progress,
ResponseErrorPanel,
Link,
} from '@backstage/core-components';
import { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';
const useStyles = makeStyles((theme: BackstageTheme) => ({
organizationNode: {
fill: 'coral',
@@ -15,12 +15,12 @@
*/
import { Entity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { catalogApiRef, entityRouteRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { GroupsExplorerContent } from '../GroupsExplorerContent';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
describe('<GroupsExplorerContent />', () => {
const catalogApi: jest.Mocked<typeof catalogApiRef.T> = {
@@ -14,9 +14,13 @@
* limitations under the License.
*/
import { Content, ContentHeader, SupportButton } from '@backstage/core';
import React from 'react';
import { GroupsDiagram } from './GroupsDiagram';
import {
Content,
ContentHeader,
SupportButton,
} from '@backstage/core-components';
type GroupsExplorerContentProps = {
title?: string;
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { ApiProvider, ApiRegistry } from '@backstage/core';
import {
ExploreTool,
exploreToolsConfigRef,
@@ -25,6 +24,7 @@ import { ThemeProvider } from '@material-ui/core';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { ToolExplorerContent } from './ToolExplorerContent';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
describe('<ToolExplorerContent />', () => {
const exploreToolsConfigApi: jest.Mocked<typeof exploreToolsConfigRef.T> = {
@@ -14,6 +14,11 @@
* limitations under the License.
*/
import { exploreToolsConfigRef } from '@backstage/plugin-explore-react';
import React from 'react';
import { useAsync } from 'react-use';
import { ToolCard } from '../ToolCard';
import {
Content,
ContentHeader,
@@ -21,13 +26,10 @@ import {
ItemCardGrid,
Progress,
SupportButton,
useApi,
WarningPanel,
} from '@backstage/core';
import { exploreToolsConfigRef } from '@backstage/plugin-explore-react';
import React from 'react';
import { useAsync } from 'react-use';
import { ToolCard } from '../ToolCard';
} from '@backstage/core-components';
import { useApi } from '@backstage/core-plugin-api';
const Body = () => {
const exploreToolsConfigApi = useApi(exploreToolsConfigRef);
+3 -3
View File
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { explorePlugin } from './plugin';
import { exploreRouteRef } from './routes';
import {
createComponentExtension,
createRoutableExtension,
} from '@backstage/core';
import { explorePlugin } from './plugin';
import { exploreRouteRef } from './routes';
} from '@backstage/core-plugin-api';
export const ExplorePage = explorePlugin.provide(
createRoutableExtension({
+1 -1
View File
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { createApiFactory, createPlugin } from '@backstage/core';
import { exploreToolsConfigRef } from '@backstage/plugin-explore-react';
import { catalogEntityRouteRef, exploreRouteRef } from './routes';
import { exampleTools } from './util/examples';
import { createApiFactory, createPlugin } from '@backstage/core-plugin-api';
export const explorePlugin = createPlugin({
id: 'explore',
+4 -1
View File
@@ -14,7 +14,10 @@
* limitations under the License.
*/
import { createExternalRouteRef, createRouteRef } from '@backstage/core';
import {
createExternalRouteRef,
createRouteRef,
} from '@backstage/core-plugin-api';
const NoIcon = () => null;