diff --git a/.changeset/olive-dodos-hammer.md b/.changeset/olive-dodos-hammer.md new file mode 100644 index 0000000000..4901d10cbb --- /dev/null +++ b/.changeset/olive-dodos-hammer.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-github-actions': patch +'@backstage/plugin-lighthouse': patch +'@backstage/plugin-techdocs': patch +--- + +Remove dependency on `@backstage/core-api`. No plugin should ever depend on that package; it's an internal concern whose important bits are re-exported by `@backstage/core` which is the public facing dependency to use. diff --git a/contrib/docs/tutorials/quickstart-app-plugin/ExampleComponent.md b/contrib/docs/tutorials/quickstart-app-plugin/ExampleComponent.md index 9b5d77bc7c..77b820d921 100644 --- a/contrib/docs/tutorials/quickstart-app-plugin/ExampleComponent.md +++ b/contrib/docs/tutorials/quickstart-app-plugin/ExampleComponent.md @@ -14,8 +14,8 @@ import { HeaderLabel, SupportButton, identityApiRef, + useApi, } from '@backstage/core'; -import { useApi } from '@backstage/core-api'; import ExampleFetchComponent from '../ExampleFetchComponent'; const ExampleComponent = () => { diff --git a/contrib/docs/tutorials/quickstart-app-plugin/ExampleFetchComponent.md b/contrib/docs/tutorials/quickstart-app-plugin/ExampleFetchComponent.md index 6061b69e93..6992d05866 100644 --- a/contrib/docs/tutorials/quickstart-app-plugin/ExampleFetchComponent.md +++ b/contrib/docs/tutorials/quickstart-app-plugin/ExampleFetchComponent.md @@ -11,8 +11,8 @@ import { TableColumn, Progress, githubAuthApiRef, + useApi, } from '@backstage/core'; -import { useApi } from '@backstage/core-api'; import { graphql } from '@octokit/graphql'; const query = `{ diff --git a/docs/tutorials/quickstart-app-plugin.md b/docs/tutorials/quickstart-app-plugin.md index 045062fdcb..6208fbe30d 100644 --- a/docs/tutorials/quickstart-app-plugin.md +++ b/docs/tutorials/quickstart-app-plugin.md @@ -72,8 +72,7 @@ Our first modification will be to extract information from the Identity API. ```tsx // Add identityApiRef to the list of imported from core -import { identityApiRef } from '@backstage/core'; -import { useApi } from '@backstage/core-api'; +import { identityApiRef, useApi } from '@backstage/core'; ``` 3. Adjust the ExampleComponent from inline to block @@ -143,8 +142,8 @@ import { TableColumn, Progress, githubAuthApiRef, + useApi, } from '@backstage/core'; -import { useApi } from '@backstage/core-api'; import { graphql } from '@octokit/graphql'; const ExampleFetchComponent = () => { diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index f876eb9e7c..771cbcfdd5 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -34,7 +34,6 @@ "dependencies": { "@backstage/catalog-model": "^0.6.0", "@backstage/core": "^0.4.3", - "@backstage/core-api": "^0.2.7", "@backstage/plugin-catalog": "^0.2.8", "@backstage/theme": "^0.2.2", "@material-ui/core": "^4.11.0", diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.test.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.test.tsx index 1d6001e038..0fd77c0443 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.test.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.test.tsx @@ -14,15 +14,15 @@ * limitations under the License. */ -import type { Props as RecentWorkflowRunsCardProps } from './RecentWorkflowRunsCard'; -import React from 'react'; -import { render } from '@testing-library/react'; -import { RecentWorkflowRunsCard } from './RecentWorkflowRunsCard'; -import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core-api'; -import { useWorkflowRuns } from '../useWorkflowRuns'; -import { ThemeProvider } from '@material-ui/core'; +import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core'; import { lightTheme } from '@backstage/theme'; +import { ThemeProvider } from '@material-ui/core'; +import { render } from '@testing-library/react'; +import React from 'react'; import { MemoryRouter } from 'react-router'; +import { useWorkflowRuns } from '../useWorkflowRuns'; +import type { Props as RecentWorkflowRunsCardProps } from './RecentWorkflowRunsCard'; +import { RecentWorkflowRunsCard } from './RecentWorkflowRunsCard'; jest.mock('../useWorkflowRuns', () => ({ useWorkflowRuns: jest.fn(), diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index 70348ece0a..9bb52b9ab1 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -14,14 +14,19 @@ * limitations under the License. */ import { Entity } from '@backstage/catalog-model'; -import { errorApiRef, useApi } from '@backstage/core-api'; +import { + EmptyState, + errorApiRef, + InfoCard, + Table, + useApi, +} from '@backstage/core'; +import { Button, Link } from '@material-ui/core'; +import React, { useEffect } from 'react'; +import { generatePath, Link as RouterLink } from 'react-router-dom'; import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; import { useWorkflowRuns } from '../useWorkflowRuns'; -import React, { useEffect } from 'react'; -import { EmptyState, InfoCard, Table } from '@backstage/core'; import { WorkflowRunStatus } from '../WorkflowRunStatus'; -import { Button, Link } from '@material-ui/core'; -import { generatePath, Link as RouterLink } from 'react-router-dom'; const firstLine = (message: string): string => message.split('\n')[0]; diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index f688f9c1db..569277054e 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -34,7 +34,6 @@ "@backstage/catalog-model": "^0.6.0", "@backstage/config": "^0.1.2", "@backstage/core": "^0.4.3", - "@backstage/core-api": "^0.2.6", "@backstage/plugin-catalog": "^0.2.7", "@backstage/theme": "^0.2.2", "@material-ui/core": "^4.11.0", diff --git a/plugins/lighthouse/src/hooks/useWebsiteForEntity.test.tsx b/plugins/lighthouse/src/hooks/useWebsiteForEntity.test.tsx index 7f5925abf8..c1773921cf 100644 --- a/plugins/lighthouse/src/hooks/useWebsiteForEntity.test.tsx +++ b/plugins/lighthouse/src/hooks/useWebsiteForEntity.test.tsx @@ -15,7 +15,7 @@ */ import React, { PropsWithChildren } from 'react'; import { renderHook } from '@testing-library/react-hooks'; -import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core-api'; +import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core'; import { lighthouseApiRef, WebsiteListResponse } from '../api'; import { useWebsiteForEntity } from './useWebsiteForEntity'; import { EntityContext } from '@backstage/plugin-catalog'; diff --git a/plugins/lighthouse/src/hooks/useWebsiteForEntity.ts b/plugins/lighthouse/src/hooks/useWebsiteForEntity.ts index c52e38f473..08d9925b7a 100644 --- a/plugins/lighthouse/src/hooks/useWebsiteForEntity.ts +++ b/plugins/lighthouse/src/hooks/useWebsiteForEntity.ts @@ -15,7 +15,7 @@ */ import { useEntity } from '@backstage/plugin-catalog'; import { LIGHTHOUSE_WEBSITE_URL_ANNOTATION } from '../../constants'; -import { errorApiRef, useApi } from '@backstage/core-api'; +import { errorApiRef, useApi } from '@backstage/core'; import { lighthouseApiRef } from '../api'; import { useAsync } from 'react-use'; diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 955b0f798c..db26ee122d 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -33,7 +33,6 @@ "dependencies": { "@backstage/catalog-model": "^0.6.0", "@backstage/core": "^0.4.3", - "@backstage/core-api": "^0.2.8", "@backstage/plugin-catalog": "^0.2.9", "@backstage/test-utils": "^0.1.6", "@backstage/theme": "^0.2.2", diff --git a/plugins/techdocs/src/reader/components/TechDocsHome.test.tsx b/plugins/techdocs/src/reader/components/TechDocsHome.test.tsx index 0924b90fc1..4979f027a6 100644 --- a/plugins/techdocs/src/reader/components/TechDocsHome.test.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsHome.test.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ApiProvider, ApiRegistry } from '@backstage/core-api'; +import { ApiProvider, ApiRegistry } from '@backstage/core'; import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog'; import { wrapInTestApp } from '@backstage/test-utils'; import { render } from '@testing-library/react'; diff --git a/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx b/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx index c05c0488ff..bc84f792a7 100644 --- a/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { TechDocsPage } from './TechDocsPage'; import { render, act } from '@testing-library/react'; import { wrapInTestApp } from '@backstage/test-utils'; -import { ApiRegistry, ApiProvider } from '@backstage/core-api'; +import { ApiRegistry, ApiProvider } from '@backstage/core'; import { techdocsApiRef, TechDocsApi,