From f9f56ddaf79cf5c8c1155c26203637f3587c542d Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 19 Apr 2024 18:35:20 +0200 Subject: [PATCH] chore: fix typescript Signed-off-by: blam --- packages/app-next/package.json | 3 + packages/app-next/src/App.tsx | 4 - packages/app-next/src/HomePage.tsx | 6 - packages/app/package.json | 1 + packages/app/src/App.tsx | 46 +- packages/app/src/apis.ts | 38 -- packages/app/src/components/Root/Root.tsx | 2 - .../components/catalog/EntityPage.test.tsx | 5 - .../app/src/components/catalog/EntityPage.tsx | 487 +----------------- packages/app/src/components/home/HomePage.tsx | 6 - .../CustomizableTemplate.stories.tsx | 4 - .../templates/DefaultTemplate.stories.tsx | 30 -- .../app/src/components/search/SearchModal.tsx | 3 - .../app/src/components/search/SearchPage.tsx | 5 - packages/app/src/plugins.ts | 2 - packages/backend-next/src/index.ts | 11 - packages/backend/src/index.ts | 56 +- packages/backend/src/plugins/adr.ts | 29 -- packages/backend/src/plugins/azure-devops.ts | 30 -- packages/backend/src/plugins/badges.ts | 35 -- packages/backend/src/plugins/codecoverage.ts | 31 -- .../backend/src/plugins/entityFeedback.ts | 28 - packages/backend/src/plugins/explore.ts | 32 -- packages/backend/src/plugins/jenkins.ts | 39 -- packages/backend/src/plugins/kafka.ts | 28 - packages/backend/src/plugins/lighthouse.ts | 36 -- packages/backend/src/plugins/linguist.ts | 40 -- packages/backend/src/plugins/permission.ts | 14 +- packages/backend/src/plugins/playlist.ts | 31 -- packages/backend/src/plugins/rollbar.ts | 28 - packages/backend/src/plugins/search.ts | 13 - packages/backend/src/plugins/techInsights.ts | 106 ---- packages/backend/src/plugins/todo.ts | 45 -- .../src/collectLegacyRoutes.test.tsx | 4 +- .../src/convertLegacyApp.test.tsx | 4 +- packages/create-app/src/lib/versions.ts | 10 - plugins/api-docs/package.json | 1 + .../api-docs/src/types.d.ts | 13 +- plugins/catalog/package.json | 3 +- .../package.json | 1 - .../src/actions/github.test.ts | 13 +- .../src/actions/githubRepoCreate.test.ts | 13 +- .../collators/ToolDocumentCollatorFactory.ts | 2 +- yarn.lock | 29 +- 44 files changed, 58 insertions(+), 1309 deletions(-) delete mode 100644 packages/backend/src/plugins/adr.ts delete mode 100644 packages/backend/src/plugins/azure-devops.ts delete mode 100644 packages/backend/src/plugins/badges.ts delete mode 100644 packages/backend/src/plugins/codecoverage.ts delete mode 100644 packages/backend/src/plugins/entityFeedback.ts delete mode 100644 packages/backend/src/plugins/explore.ts delete mode 100644 packages/backend/src/plugins/jenkins.ts delete mode 100644 packages/backend/src/plugins/kafka.ts delete mode 100644 packages/backend/src/plugins/lighthouse.ts delete mode 100644 packages/backend/src/plugins/linguist.ts delete mode 100644 packages/backend/src/plugins/playlist.ts delete mode 100644 packages/backend/src/plugins/rollbar.ts delete mode 100644 packages/backend/src/plugins/techInsights.ts delete mode 100644 packages/backend/src/plugins/todo.ts rename packages/backend/src/plugins/nomad.ts => plugins/api-docs/src/types.d.ts (64%) diff --git a/packages/app-next/package.json b/packages/app-next/package.json index 5c93e16311..fdb84f3e81 100644 --- a/packages/app-next/package.json +++ b/packages/app-next/package.json @@ -17,11 +17,14 @@ "@backstage/cli": "workspace:^", "@backstage/config": "workspace:^", "@backstage/core-app-api": "workspace:^", + "@backstage/core-compat-api": "workspace:^", "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/frontend-app-api": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/integration-react": "workspace:^", "@backstage/plugin-api-docs": "workspace:^", + "@backstage/plugin-app-visualizer": "workspace:^", "@backstage/plugin-auth-react": "workspace:^", "@backstage/plugin-catalog": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", diff --git a/packages/app-next/src/App.tsx b/packages/app-next/src/App.tsx index 03a6649c27..83b921aea1 100644 --- a/packages/app-next/src/App.tsx +++ b/packages/app-next/src/App.tsx @@ -18,8 +18,6 @@ import React from 'react'; import { createApp } from '@backstage/frontend-app-api'; import { pagesPlugin } from './examples/pagesPlugin'; import notFoundErrorPage from './examples/notFoundErrorPageExtension'; -import graphiqlPlugin from '@backstage/plugin-graphiql/alpha'; -import techRadarPlugin from '@backstage/plugin-tech-radar/alpha'; import userSettingsPlugin from '@backstage/plugin-user-settings/alpha'; import homePlugin, { titleExtensionDataRef, @@ -118,9 +116,7 @@ const collectedLegacyPlugins = convertLegacyApp( const app = createApp({ features: [ - graphiqlPlugin, pagesPlugin, - techRadarPlugin, techdocsPlugin, userSettingsPlugin, homePlugin, diff --git a/packages/app-next/src/HomePage.tsx b/packages/app-next/src/HomePage.tsx index cb31beb34a..d6ee5cbb04 100644 --- a/packages/app-next/src/HomePage.tsx +++ b/packages/app-next/src/HomePage.tsx @@ -27,11 +27,8 @@ import { WelcomeTitle, } from '@backstage/plugin-home'; import { Content, Header, Page } from '@backstage/core-components'; -import { HomePageCalendar } from '@backstage/plugin-gcalendar'; -import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar'; import React from 'react'; import HomeIcon from '@material-ui/icons/Home'; -import { HomePagePagerDutyCard } from '@backstage/plugin-pagerduty'; const clockConfigs: ClockConfig[] = [ { @@ -96,9 +93,6 @@ export const homePage = ( - - - diff --git a/packages/app/package.json b/packages/app/package.json index 037bbc6295..809bf35313 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -52,6 +52,7 @@ "@backstage/plugin-catalog-import": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", "@backstage/plugin-catalog-unprocessed-entities": "workspace:^", + "@backstage/plugin-devtools": "workspace:^", "@backstage/plugin-home": "workspace:^", "@backstage/plugin-kubernetes": "workspace:^", "@backstage/plugin-kubernetes-cluster": "workspace:^", diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index 3d8bd45e5a..652582984e 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -34,8 +34,6 @@ import { SignInPage, } from '@backstage/core-components'; import { apiDocsPlugin, ApiExplorerPage } from '@backstage/plugin-api-docs'; -import { AzurePullRequestsPage } from '@backstage/plugin-azure-devops'; - import { CatalogEntityPage, CatalogIndexPage, @@ -47,24 +45,15 @@ import { CatalogImportPage, catalogImportPlugin, } from '@backstage/plugin-catalog-import'; -import { - CostInsightsLabelDataflowInstructionsPage, - CostInsightsPage, - CostInsightsProjectGrowthInstructionsPage, -} from '@backstage/plugin-cost-insights'; import { orgPlugin } from '@backstage/plugin-org'; -import { ExplorePage } from '@backstage/plugin-explore'; -import { GcpProjectsPage } from '@backstage/plugin-gcp-projects'; import { HomepageCompositionRoot, VisitListener } from '@backstage/plugin-home'; -import { LighthousePage } from '@backstage/plugin-lighthouse'; -import { NewRelicPage } from '@backstage/plugin-newrelic'; + import { ScaffolderPage, scaffolderPlugin } from '@backstage/plugin-scaffolder'; import { ScaffolderFieldExtensions, ScaffolderLayouts, } from '@backstage/plugin-scaffolder-react'; import { SearchPage } from '@backstage/plugin-search'; -import { TechRadarPage } from '@backstage/plugin-tech-radar'; import { TechDocsIndexPage, techdocsPlugin, @@ -96,16 +85,11 @@ import { providers } from './identityProviders'; import * as plugins from './plugins'; import { techDocsPage } from './components/techdocs/TechDocsPage'; -import { ApacheAirflowPage } from '@backstage/plugin-apache-airflow'; import { RequirePermission } from '@backstage/plugin-permission-react'; import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha'; -import { PlaylistIndexPage, PlaylistPage } from '@backstage/plugin-playlist'; import { TwoColumnLayout } from './components/scaffolder/customScaffolderLayouts'; -import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card'; -import { StackstormPage } from '@backstage/plugin-stackstorm'; -import { PuppetDbPage } from '@backstage/plugin-puppetdb'; -import { DevToolsPage } from '@backstage/plugin-devtools'; import { customDevToolsPage } from './components/devtools/CustomDevToolsPage'; +import { DevToolsPage } from '@backstage/plugin-devtools'; import { CatalogUnprocessedEntitiesPage } from '@backstage/plugin-catalog-unprocessed-entities'; import { NotificationsPage } from '@backstage/plugin-notifications'; @@ -237,39 +221,17 @@ const routes = ( - } /> - } - /> - } /> + } /> - } /> - } /> }> {searchPage} - } /> - } - /> - } - /> + }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> }> {customDevToolsPage} diff --git a/packages/app/src/apis.ts b/packages/app/src/apis.ts index f2fda9882b..0c2ccbad22 100644 --- a/packages/app/src/apis.ts +++ b/packages/app/src/apis.ts @@ -19,22 +19,11 @@ import { scmIntegrationsApiRef, ScmAuth, } from '@backstage/integration-react'; -import { - costInsightsApiRef, - ExampleCostInsightsClient, -} from '@backstage/plugin-cost-insights'; -import { - graphQlBrowseApiRef, - GraphQLEndpoints, -} from '@backstage/plugin-graphiql'; import { AnyApiFactory, configApiRef, createApiFactory, discoveryApiRef, - errorApiRef, - fetchApiRef, - githubAuthApiRef, } from '@backstage/core-plugin-api'; import { AuthProxyDiscoveryApi } from './AuthProxyDiscoveryApi'; @@ -51,31 +40,4 @@ export const apis: AnyApiFactory[] = [ }), ScmAuth.createDefaultApiFactory(), - - createApiFactory({ - api: graphQlBrowseApiRef, - deps: { - errorApi: errorApiRef, - fetchApi: fetchApiRef, - githubAuthApi: githubAuthApiRef, - }, - factory: ({ errorApi, fetchApi, githubAuthApi }) => - GraphQLEndpoints.from([ - GraphQLEndpoints.create({ - id: 'gitlab', - title: 'GitLab', - url: 'https://gitlab.com/api/graphql', - fetchApi, - }), - GraphQLEndpoints.github({ - id: 'github', - title: 'GitHub', - errorApi, - fetchApi, - githubAuthApi, - }), - ]), - }), - - createApiFactory(costInsightsApiRef, new ExampleCostInsightsClient()), ]; diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index 6294aa7856..af053f623c 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -32,7 +32,6 @@ import { UserSettingsSignInAvatar, } from '@backstage/plugin-user-settings'; import { SidebarSearchModal } from '@backstage/plugin-search'; -import { Shortcuts } from '@backstage/plugin-shortcuts'; import { Link, Sidebar, @@ -166,7 +165,6 @@ export const Root = ({ children }: PropsWithChildren<{}>) => ( - diff --git a/packages/app/src/components/catalog/EntityPage.test.tsx b/packages/app/src/components/catalog/EntityPage.test.tsx index 25181db2c1..586c45840b 100644 --- a/packages/app/src/components/catalog/EntityPage.test.tsx +++ b/packages/app/src/components/catalog/EntityPage.test.tsx @@ -20,7 +20,6 @@ import { starredEntitiesApiRef, MockStarredEntitiesApi, } from '@backstage/plugin-catalog-react'; -import { githubActionsApiRef } from '@backstage/plugin-github-actions'; import { permissionApiRef } from '@backstage/plugin-permission-react'; import { MockPermissionApi, @@ -47,9 +46,6 @@ describe('EntityPage Test', () => { }, }; - const mockedApi = { - listWorkflowRuns: jest.fn().mockResolvedValue([]), - }; const mockPermissionApi = new MockPermissionApi(); const rootRouteRef = catalogPlugin.routes.catalogIndex; @@ -58,7 +54,6 @@ describe('EntityPage Test', () => { const rendered = await renderInTestApp( { - const [badgesDialogOpen, setBadgesDialogOpen] = useState(false); - const [playlistDialogOpen, setPlaylistDialogOpen] = useState(false); - - const extraMenuItems = useMemo(() => { - return [ - { - title: 'Badges', - Icon: BadgeIcon, - onClick: () => setBadgesDialogOpen(true), - }, - { - title: 'Add to playlist', - Icon: PlaylistAddIcon, - onClick: () => setPlaylistDialogOpen(true), - }, - ]; - }, []); - return ( <> {props.children} - setBadgesDialogOpen(false)} - /> - setPlaylistDialogOpen(false)} - /> ); }; @@ -249,42 +115,6 @@ const techdocsContent = ( export const cicdContent = ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -const cicdCard = ( - - - - - - - - boolean}> - - - - - - - - - - - -); - const entityWarningContent = ( <> @@ -354,30 +162,6 @@ const entityWarningContent = ( ); -const errorsContent = ( - - - - - - - - - -); - -const pullRequestsContent = ( - - - - - - - - - -); - const overviewContent = ( {entityWarningContent} @@ -389,22 +173,6 @@ const overviewContent = ( - - - - - - - - - - - - - - - - @@ -417,69 +185,9 @@ const overviewContent = ( - - - - - - - - - - - - - - - {cicdCard} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); @@ -493,10 +201,6 @@ const serviceEntityPage = ( {cicdContent} - - {errorsContent} - - @@ -523,83 +227,9 @@ const serviceEntityPage = ( {techdocsContent} - - - - - - - - - - - - - - - {pullRequestsContent} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); @@ -613,14 +243,6 @@ const websiteEntityPage = ( {cicdContent} - - - - - - {errorsContent} - - @@ -636,53 +258,9 @@ const websiteEntityPage = ( {techdocsContent} - - - - - - - - - - - - - - - {pullRequestsContent} - - - - - - - - - - - - - - - - - ); @@ -695,14 +273,6 @@ const defaultEntityPage = ( {techdocsContent} - - - - - - - - ); @@ -739,11 +309,6 @@ const apiPage = ( - - - - - @@ -756,10 +321,6 @@ const apiPage = ( - - - - ); @@ -777,9 +338,6 @@ const userPage = ( entityFilterKind={customEntityFilterKind} /> - - - @@ -805,14 +363,8 @@ const groupPage = ( - - - - - - ); @@ -836,18 +388,6 @@ const systemPage = ( - - - - - - - - - - - - @@ -869,9 +409,6 @@ const systemPage = ( unidirectional={false} /> - - - ); @@ -889,16 +426,8 @@ const domainPage = ( - - - - - - - - ); @@ -925,16 +454,6 @@ const resourcePage = ( > - - - - - - ); diff --git a/packages/app/src/components/home/HomePage.tsx b/packages/app/src/components/home/HomePage.tsx index 5940b0ac6c..026cd5faff 100644 --- a/packages/app/src/components/home/HomePage.tsx +++ b/packages/app/src/components/home/HomePage.tsx @@ -28,11 +28,8 @@ import { } from '@backstage/plugin-home'; import { Content, Header, Page } from '@backstage/core-components'; import { HomePageSearchBar } from '@backstage/plugin-search'; -import { HomePageCalendar } from '@backstage/plugin-gcalendar'; -import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar'; import React from 'react'; import HomeIcon from '@material-ui/icons/Home'; -import { HomePagePagerDutyCard } from '@backstage/plugin-pagerduty'; const clockConfigs: ClockConfig[] = [ { @@ -98,9 +95,6 @@ export const homePage = ( - - - diff --git a/packages/app/src/components/home/templates/CustomizableTemplate.stories.tsx b/packages/app/src/components/home/templates/CustomizableTemplate.stories.tsx index e587e52da4..33a1bc2012 100644 --- a/packages/app/src/components/home/templates/CustomizableTemplate.stories.tsx +++ b/packages/app/src/components/home/templates/CustomizableTemplate.stories.tsx @@ -30,8 +30,6 @@ import { configApiRef } from '@backstage/core-plugin-api'; import { ConfigReader } from '@backstage/config'; import { searchApiRef } from '@backstage/plugin-search-react'; import { HomePageSearchBar, searchPlugin } from '@backstage/plugin-search'; -import { HomePageCalendar } from '@backstage/plugin-gcalendar'; -import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar'; import React, { ComponentType } from 'react'; const entities = [ @@ -145,8 +143,6 @@ export const CustomizableTemplate = () => { // remove the widgets as they want. - - ); diff --git a/packages/app/src/components/home/templates/DefaultTemplate.stories.tsx b/packages/app/src/components/home/templates/DefaultTemplate.stories.tsx index 05d9a4eecd..64e6a87f60 100644 --- a/packages/app/src/components/home/templates/DefaultTemplate.stories.tsx +++ b/packages/app/src/components/home/templates/DefaultTemplate.stories.tsx @@ -36,7 +36,6 @@ import { searchApiRef, SearchContextProvider, } from '@backstage/plugin-search-react'; -import { stackOverflowApiRef, HomePageStackOverflowQuestions } from '@backstage/plugin-stack-overflow'; import { Grid, makeStyles } from '@material-ui/core'; import React, { ComponentType, PropsWithChildren } from 'react'; @@ -79,25 +78,6 @@ const mockCatalogApi = { getEntities: async () => ({ items: entities }), }; -const mockStackOverflowApi = { - listQuestions: async () => [ - { - title: 'Customizing Spotify backstage UI', - link: 'stackoverflow.question/1', - answer_count: 0, - tags: ['backstage'], - owner: { 'some owner': 'name' }, - }, - { - title: 'Customizing Spotify backstage UI', - link: 'stackoverflow.question/1', - answer_count: 0, - tags: ['backstage'], - owner: { 'some owner': 'name' }, - }, - ], -}; - const starredEntitiesApi = new MockStarredEntitiesApi(); starredEntitiesApi.toggleStarred('component:default/example-starred-entity'); starredEntitiesApi.toggleStarred('component:default/example-starred-entity-2'); @@ -112,7 +92,6 @@ export default { <> Promise.resolve({ results: [] }) }], @@ -203,15 +182,6 @@ export const DefaultTemplate = () => {
- - - diff --git a/packages/app/src/components/search/SearchModal.tsx b/packages/app/src/components/search/SearchModal.tsx index 23aec53a58..34caeeae63 100644 --- a/packages/app/src/components/search/SearchModal.tsx +++ b/packages/app/src/components/search/SearchModal.tsx @@ -19,7 +19,6 @@ import { CATALOG_FILTER_EXISTS, catalogApiRef, } from '@backstage/plugin-catalog-react'; -import { ToolSearchResultListItem } from '@backstage/plugin-explore'; import { searchPlugin, SearchType } from '@backstage/plugin-search'; import { SearchBar, @@ -41,7 +40,6 @@ import { import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; import ArrowForwardIcon from '@material-ui/icons/ArrowForward'; -import BuildIcon from '@material-ui/icons/Build'; import CloseIcon from '@material-ui/icons/Close'; import React, { useCallback, useEffect, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -207,7 +205,6 @@ export const SearchModal = ({ toggleModal }: { toggleModal: () => void }) => { } /> } /> - } /> diff --git a/packages/app/src/components/search/SearchPage.tsx b/packages/app/src/components/search/SearchPage.tsx index d904aef45c..6914fa71cb 100644 --- a/packages/app/src/components/search/SearchPage.tsx +++ b/packages/app/src/components/search/SearchPage.tsx @@ -28,7 +28,6 @@ import { catalogApiRef, CATALOG_FILTER_EXISTS, } from '@backstage/plugin-catalog-react'; -import { AdrSearchResultListItem } from '@backstage/plugin-adr'; import { SearchType } from '@backstage/plugin-search'; import { SearchBar, @@ -41,8 +40,6 @@ import { import { TechDocsSearchResultListItem } from '@backstage/plugin-techdocs'; import { Grid, makeStyles, Paper, Theme } from '@material-ui/core'; import React from 'react'; -import { ToolSearchResultListItem } from '@backstage/plugin-explore'; -import BuildIcon from '@material-ui/icons/Build'; const useStyles = makeStyles((theme: Theme) => ({ filter: { @@ -131,8 +128,6 @@ const SearchPage = () => { } /> } /> - } /> - } /> diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index ddd12bea2c..9280536997 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -16,7 +16,5 @@ // TODO(Rugvip): This plugin is currently not part of the app element tree, // ideally we have an API for the context menu that permits that. -export { badgesPlugin } from '@backstage/plugin-badges'; -export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; export { homePlugin } from '@backstage/plugin-home'; export { signalsPlugin } from '@backstage/plugin-signals'; diff --git a/packages/backend-next/src/index.ts b/packages/backend-next/src/index.ts index 4965462b2c..a4acd19cf2 100644 --- a/packages/backend-next/src/index.ts +++ b/packages/backend-next/src/index.ts @@ -22,23 +22,14 @@ backend.add(import('@backstage/plugin-auth-backend')); backend.add(import('./authModuleGithubProvider')); backend.add(import('@backstage/plugin-auth-backend-module-guest-provider')); -backend.add(import('@backstage/plugin-adr-backend')); backend.add(import('@backstage/plugin-app-backend/alpha')); -backend.add(import('@backstage/plugin-azure-devops-backend')); -backend.add(import('@backstage/plugin-badges-backend')); backend.add(import('@backstage/plugin-catalog-backend-module-unprocessed')); backend.add( import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'), ); backend.add(import('@backstage/plugin-catalog-backend/alpha')); backend.add(import('@backstage/plugin-devtools-backend')); -backend.add(import('@backstage/plugin-entity-feedback-backend')); -backend.add(import('@backstage/plugin-jenkins-backend')); backend.add(import('@backstage/plugin-kubernetes-backend/alpha')); -backend.add(import('@backstage/plugin-lighthouse-backend')); -backend.add(import('@backstage/plugin-linguist-backend')); -backend.add(import('@backstage/plugin-playlist-backend')); -backend.add(import('@backstage/plugin-nomad-backend')); backend.add( import('@backstage/plugin-permission-backend-module-allow-all-policy'), ); @@ -54,8 +45,6 @@ backend.add( ); backend.add(import('@backstage/plugin-search-backend/alpha')); backend.add(import('@backstage/plugin-techdocs-backend/alpha')); -backend.add(import('@backstage/plugin-todo-backend')); -backend.add(import('@backstage/plugin-sonarqube-backend')); backend.add(import('@backstage/plugin-signals-backend')); backend.add(import('@backstage/plugin-notifications-backend')); diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 026fff643e..34ea8b0f6c 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -40,32 +40,17 @@ import { Config } from '@backstage/config'; import healthcheck from './plugins/healthcheck'; import { metricsHandler, metricsInit } from './metrics'; import auth from './plugins/auth'; -import azureDevOps from './plugins/azure-devops'; import catalog from './plugins/catalog'; -import codeCoverage from './plugins/codecoverage'; -import entityFeedback from './plugins/entityFeedback'; import events from './plugins/events'; -import explore from './plugins/explore'; import kubernetes from './plugins/kubernetes'; -import kafka from './plugins/kafka'; -import rollbar from './plugins/rollbar'; import scaffolder from './plugins/scaffolder'; import proxy from './plugins/proxy'; import search from './plugins/search'; import techdocs from './plugins/techdocs'; -import techInsights from './plugins/techInsights'; -import todo from './plugins/todo'; import app from './plugins/app'; -import badges from './plugins/badges'; -import jenkins from './plugins/jenkins'; import permission from './plugins/permission'; -import playlist from './plugins/playlist'; -import adr from './plugins/adr'; -import lighthouse from './plugins/lighthouse'; -import linguist from './plugins/linguist'; -import devTools from './plugins/devtools'; -import nomad from './plugins/nomad'; import signals from './plugins/signals'; +import devtools from './plugins/devtools'; import { PluginEnvironment } from './types'; import { ServerPermissionClient } from '@backstage/plugin-permission-node'; import { DefaultIdentityClient } from '@backstage/plugin-auth-node'; @@ -153,69 +138,32 @@ async function main() { const healthcheckEnv = useHotMemoize(module, () => createEnv('healthcheck')); const catalogEnv = useHotMemoize(module, () => createEnv('catalog')); - const codeCoverageEnv = useHotMemoize(module, () => - createEnv('code-coverage'), - ); const scaffolderEnv = useHotMemoize(module, () => createEnv('scaffolder')); const authEnv = useHotMemoize(module, () => createEnv('auth')); - const azureDevOpsEnv = useHotMemoize(module, () => createEnv('azure-devops')); const proxyEnv = useHotMemoize(module, () => createEnv('proxy')); - const rollbarEnv = useHotMemoize(module, () => createEnv('rollbar')); const searchEnv = useHotMemoize(module, () => createEnv('search')); const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs')); - const todoEnv = useHotMemoize(module, () => createEnv('todo')); const kubernetesEnv = useHotMemoize(module, () => createEnv('kubernetes')); - const kafkaEnv = useHotMemoize(module, () => createEnv('kafka')); const appEnv = useHotMemoize(module, () => createEnv('app')); - const badgesEnv = useHotMemoize(module, () => createEnv('badges')); - const jenkinsEnv = useHotMemoize(module, () => createEnv('jenkins')); - const adrEnv = useHotMemoize(module, () => createEnv('adr')); - const techInsightsEnv = useHotMemoize(module, () => - createEnv('tech-insights'), - ); const permissionEnv = useHotMemoize(module, () => createEnv('permission')); - const playlistEnv = useHotMemoize(module, () => createEnv('playlist')); - const entityFeedbackEnv = useHotMemoize(module, () => - createEnv('entityFeedback'), - ); const eventsEnv = useHotMemoize(module, () => createEnv('events')); - const exploreEnv = useHotMemoize(module, () => createEnv('explore')); - const lighthouseEnv = useHotMemoize(module, () => createEnv('lighthouse')); - const linguistEnv = useHotMemoize(module, () => createEnv('linguist')); const devToolsEnv = useHotMemoize(module, () => createEnv('devtools')); - const nomadEnv = useHotMemoize(module, () => createEnv('nomad')); const signalsEnv = useHotMemoize(module, () => createEnv('signals')); const apiRouter = Router(); apiRouter.use('/catalog', await catalog(catalogEnv)); - apiRouter.use('/code-coverage', await codeCoverage(codeCoverageEnv)); apiRouter.use('/events', await events(eventsEnv)); - apiRouter.use('/rollbar', await rollbar(rollbarEnv)); apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv)); - apiRouter.use('/tech-insights', await techInsights(techInsightsEnv)); apiRouter.use('/auth', await auth(authEnv)); - apiRouter.use('/azure-devops', await azureDevOps(azureDevOpsEnv)); apiRouter.use('/search', await search(searchEnv)); apiRouter.use('/techdocs', await techdocs(techdocsEnv)); - apiRouter.use('/todo', await todo(todoEnv)); apiRouter.use('/kubernetes', await kubernetes(kubernetesEnv)); - apiRouter.use('/kafka', await kafka(kafkaEnv)); apiRouter.use('/proxy', await proxy(proxyEnv)); - apiRouter.use('/badges', await badges(badgesEnv)); - apiRouter.use('/jenkins', await jenkins(jenkinsEnv)); apiRouter.use('/permission', await permission(permissionEnv)); - apiRouter.use('/playlist', await playlist(playlistEnv)); - apiRouter.use('/explore', await explore(exploreEnv)); - apiRouter.use('/entity-feedback', await entityFeedback(entityFeedbackEnv)); - apiRouter.use('/adr', await adr(adrEnv)); - apiRouter.use('/linguist', await linguist(linguistEnv)); - apiRouter.use('/devtools', await devTools(devToolsEnv)); - apiRouter.use('/nomad', await nomad(nomadEnv)); + apiRouter.use('/devtools', await devtools(devToolsEnv)); apiRouter.use('/signals', await signals(signalsEnv)); apiRouter.use(notFoundHandler()); - await lighthouse(lighthouseEnv); - const service = createServiceBuilder(module) .loadConfig(config) .addRouter('', await healthcheck(healthcheckEnv)) diff --git a/packages/backend/src/plugins/adr.ts b/packages/backend/src/plugins/adr.ts deleted file mode 100644 index 6fa0d72969..0000000000 --- a/packages/backend/src/plugins/adr.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { createRouter } from '@backstage/plugin-adr-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - reader: env.reader, - cacheClient: env.cache.getClient(), - logger: env.logger, - }); -} diff --git a/packages/backend/src/plugins/azure-devops.ts b/packages/backend/src/plugins/azure-devops.ts deleted file mode 100644 index 719bb0500e..0000000000 --- a/packages/backend/src/plugins/azure-devops.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2020 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 { createRouter } from '@backstage/plugin-azure-devops-backend'; -import { Router } from 'express'; -import type { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return createRouter({ - logger: env.logger, - config: env.config, - reader: env.reader, - permissions: env.permissions, - }); -} diff --git a/packages/backend/src/plugins/badges.ts b/packages/backend/src/plugins/badges.ts deleted file mode 100644 index fa50731809..0000000000 --- a/packages/backend/src/plugins/badges.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2021 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 { - createRouter, - createDefaultBadgeFactories, -} from '@backstage/plugin-badges-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - config: env.config, - discovery: env.discovery, - badgeFactories: createDefaultBadgeFactories(), - tokenManager: env.tokenManager, - logger: env.logger, - identity: env.identity, - }); -} diff --git a/packages/backend/src/plugins/codecoverage.ts b/packages/backend/src/plugins/codecoverage.ts deleted file mode 100644 index adb20da2b3..0000000000 --- a/packages/backend/src/plugins/codecoverage.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 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 { createRouter } from '@backstage/plugin-code-coverage-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - config: env.config, - discovery: env.discovery, - database: env.database, - urlReader: env.reader, - logger: env.logger, - }); -} diff --git a/packages/backend/src/plugins/entityFeedback.ts b/packages/backend/src/plugins/entityFeedback.ts deleted file mode 100644 index c37c3c9a97..0000000000 --- a/packages/backend/src/plugins/entityFeedback.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2023 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 { createRouter } from '@backstage/plugin-entity-feedback-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default function createPlugin(env: PluginEnvironment): Promise { - return createRouter({ - database: env.database, - discovery: env.discovery, - identity: env.identity, - logger: env.logger, - }); -} diff --git a/packages/backend/src/plugins/explore.ts b/packages/backend/src/plugins/explore.ts deleted file mode 100644 index 131f9461fa..0000000000 --- a/packages/backend/src/plugins/explore.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2020 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 { - createRouter, - exampleTools, - StaticExploreToolProvider, -} from '@backstage/plugin-explore-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - logger: env.logger, - toolProvider: StaticExploreToolProvider.fromData(exampleTools), - }); -} diff --git a/packages/backend/src/plugins/jenkins.ts b/packages/backend/src/plugins/jenkins.ts deleted file mode 100644 index 7d47ee338d..0000000000 --- a/packages/backend/src/plugins/jenkins.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020 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 { - createRouter, - DefaultJenkinsInfoProvider, -} from '@backstage/plugin-jenkins-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; -import { CatalogClient } from '@backstage/catalog-client'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - const catalog = new CatalogClient({ discoveryApi: env.discovery }); - - return await createRouter({ - logger: env.logger, - jenkinsInfoProvider: DefaultJenkinsInfoProvider.fromConfig({ - catalog, - config: env.config, - discovery: env.discovery, - }), - discovery: env.discovery, - }); -} diff --git a/packages/backend/src/plugins/kafka.ts b/packages/backend/src/plugins/kafka.ts deleted file mode 100644 index 784bad3145..0000000000 --- a/packages/backend/src/plugins/kafka.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 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 { createRouter } from '@backstage/plugin-kafka-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - logger: env.logger, - config: env.config, - }); -} diff --git a/packages/backend/src/plugins/lighthouse.ts b/packages/backend/src/plugins/lighthouse.ts deleted file mode 100644 index 77204159cb..0000000000 --- a/packages/backend/src/plugins/lighthouse.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2020 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 { createScheduler } from '@backstage/plugin-lighthouse-backend'; -import { PluginEnvironment } from '../types'; -import { CatalogClient } from '@backstage/catalog-client'; - -export default async function createPlugin(env: PluginEnvironment) { - const { logger, scheduler, config, tokenManager, discovery } = env; - - const catalogClient = new CatalogClient({ - discoveryApi: env.discovery, - }); - - await createScheduler({ - logger, - scheduler, - config, - catalogClient, - tokenManager, - discovery, - }); -} diff --git a/packages/backend/src/plugins/linguist.ts b/packages/backend/src/plugins/linguist.ts deleted file mode 100644 index 2c8713a7e3..0000000000 --- a/packages/backend/src/plugins/linguist.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { TaskScheduleDefinition } from '@backstage/backend-tasks'; -import { createRouter } from '@backstage/plugin-linguist-backend'; -import { Router } from 'express'; -import type { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - const schedule: TaskScheduleDefinition = { - frequency: { minutes: 2 }, - timeout: { minutes: 15 }, - initialDelay: { seconds: 15 }, - }; - - return createRouter( - { - schedule: schedule, - age: { days: 30 }, - batchSize: 2, - useSourceLocation: false, - }, - { ...env }, - ); -} diff --git a/packages/backend/src/plugins/permission.ts b/packages/backend/src/plugins/permission.ts index 7192a1ddec..fd0a989f06 100644 --- a/packages/backend/src/plugins/permission.ts +++ b/packages/backend/src/plugins/permission.ts @@ -24,23 +24,15 @@ import { PermissionPolicy, PolicyQuery, } from '@backstage/plugin-permission-node'; -import { - DefaultPlaylistPermissionPolicy, - isPlaylistPermission, -} from '@backstage/plugin-playlist-backend'; import { Router } from 'express'; import { PluginEnvironment } from '../types'; class ExamplePermissionPolicy implements PermissionPolicy { - private playlistPermissionPolicy = new DefaultPlaylistPermissionPolicy(); - async handle( - request: PolicyQuery, - user?: BackstageIdentityResponse, + _request: PolicyQuery, + _user?: BackstageIdentityResponse, ): Promise { - if (isPlaylistPermission(request.permission)) { - return this.playlistPermissionPolicy.handle(request, user); - } + // some logic to determine if the user is allowed to access the resource return { result: AuthorizeResult.ALLOW, diff --git a/packages/backend/src/plugins/playlist.ts b/packages/backend/src/plugins/playlist.ts deleted file mode 100644 index 6cae6a30ab..0000000000 --- a/packages/backend/src/plugins/playlist.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 { createRouter } from '@backstage/plugin-playlist-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - database: env.database, - discovery: env.discovery, - identity: env.identity, - logger: env.logger, - permissions: env.permissions, - }); -} diff --git a/packages/backend/src/plugins/rollbar.ts b/packages/backend/src/plugins/rollbar.ts deleted file mode 100644 index c679be40a7..0000000000 --- a/packages/backend/src/plugins/rollbar.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 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 { createRouter } from '@backstage/plugin-rollbar-backend'; -import { Router } from 'express'; -import type { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - logger: env.logger, - config: env.config, - }); -} diff --git a/packages/backend/src/plugins/search.ts b/packages/backend/src/plugins/search.ts index a5b976ec9d..dcdcfa9b79 100644 --- a/packages/backend/src/plugins/search.ts +++ b/packages/backend/src/plugins/search.ts @@ -15,7 +15,6 @@ */ import { useHotCleanup } from '@backstage/backend-common'; -import { DefaultAdrCollatorFactory } from '@backstage/plugin-adr-backend'; import { DefaultCatalogCollatorFactory } from '@backstage/plugin-search-backend-module-catalog'; import { ToolDocumentCollatorFactory } from '@backstage/plugin-search-backend-module-explore'; import { createRouter } from '@backstage/plugin-search-backend'; @@ -70,18 +69,6 @@ export default async function createPlugin( // Collators are responsible for gathering documents known to plugins. This // particular collator gathers entities from the software catalog. - indexBuilder.addCollator({ - schedule, - factory: DefaultAdrCollatorFactory.fromConfig({ - cache: env.cache, - config: env.config, - discovery: env.discovery, - logger: env.logger, - reader: env.reader, - tokenManager: env.tokenManager, - }), - }); - indexBuilder.addCollator({ schedule, factory: DefaultCatalogCollatorFactory.fromConfig(env.config, { diff --git a/packages/backend/src/plugins/techInsights.ts b/packages/backend/src/plugins/techInsights.ts deleted file mode 100644 index 8575a46480..0000000000 --- a/packages/backend/src/plugins/techInsights.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2020 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 { - createRouter, - buildTechInsightsContext, - createFactRetrieverRegistration, - entityOwnershipFactRetriever, - entityMetadataFactRetriever, - techdocsFactRetriever, -} from '@backstage/plugin-tech-insights-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; -import { - JsonRulesEngineFactCheckerFactory, - JSON_RULE_ENGINE_CHECK_TYPE, -} from '@backstage/plugin-tech-insights-backend-module-jsonfc'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - const techInsightsContext = await buildTechInsightsContext({ - logger: env.logger, - config: env.config, - database: env.database, - scheduler: env.scheduler, - discovery: env.discovery, - tokenManager: env.tokenManager, - factRetrievers: [ - createFactRetrieverRegistration({ - cadence: '1 1 1 * *', // Example cron, At 01:01 on day-of-month 1. - factRetriever: entityOwnershipFactRetriever, - }), - createFactRetrieverRegistration({ - cadence: '1 1 1 * *', - factRetriever: entityMetadataFactRetriever, - }), - createFactRetrieverRegistration({ - cadence: '1 1 1 * *', - factRetriever: techdocsFactRetriever, - }), - ], - factCheckerFactory: new JsonRulesEngineFactCheckerFactory({ - logger: env.logger, - checks: [ - { - id: 'titleCheck', - type: JSON_RULE_ENGINE_CHECK_TYPE, - name: 'Title Check', - description: - 'Verifies that a Title, used to improve readability, has been set for this entity', - factIds: ['entityMetadataFactRetriever'], - rule: { - conditions: { - all: [ - { - fact: 'hasTitle', - operator: 'equal', - value: true, - }, - ], - }, - }, - }, - { - id: 'techDocsCheck', - type: JSON_RULE_ENGINE_CHECK_TYPE, - name: 'TechDocs Check', - description: - 'Verifies that TechDocs has been enabled for this entity', - factIds: ['techdocsFactRetriever'], - rule: { - conditions: { - all: [ - { - fact: 'hasAnnotationBackstageIoTechdocsRef', - operator: 'equal', - value: true, - }, - ], - }, - }, - }, - ], - }), - }); - - return await createRouter({ - ...techInsightsContext, - logger: env.logger, - config: env.config, - }); -} diff --git a/packages/backend/src/plugins/todo.ts b/packages/backend/src/plugins/todo.ts deleted file mode 100644 index fb460b5f70..0000000000 --- a/packages/backend/src/plugins/todo.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020 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 { CatalogClient } from '@backstage/catalog-client'; -import { - createRouter, - TodoReaderService, - TodoScmReader, -} from '@backstage/plugin-todo-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - const todoReader = TodoScmReader.fromConfig(env.config, { - logger: env.logger, - reader: env.reader, - }); - - const catalogClient = new CatalogClient({ - discoveryApi: env.discovery, - }); - - const todoService = new TodoReaderService({ - todoReader, - catalogClient, - }); - - return await createRouter({ - todoService, - }); -} diff --git a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx index 2c8288b878..aa3beee679 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx @@ -23,8 +23,8 @@ import { EntitySwitch, isKind, } from '@backstage/plugin-catalog'; -import { PuppetDbPage } from '@backstage/plugin-puppetdb'; -import { StackstormPage } from '@backstage/plugin-stackstorm'; +import { PuppetDbPage } from '@backstage-community/plugin-puppetdb'; +import { StackstormPage } from '@backstage-community/plugin-stackstorm'; import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card'; import React, { Fragment } from 'react'; import { Navigate, Route, Routes } from 'react-router-dom'; diff --git a/packages/core-compat-api/src/convertLegacyApp.test.tsx b/packages/core-compat-api/src/convertLegacyApp.test.tsx index ef65603c85..2e7be66915 100644 --- a/packages/core-compat-api/src/convertLegacyApp.test.tsx +++ b/packages/core-compat-api/src/convertLegacyApp.test.tsx @@ -15,8 +15,8 @@ */ import { AppRouter, FlatRoutes } from '@backstage/core-app-api'; -import { PuppetDbPage } from '@backstage/plugin-puppetdb'; -import { StackstormPage } from '@backstage/plugin-stackstorm'; +import { PuppetDbPage } from '@backstage-community/plugin-puppetdb'; +import { StackstormPage } from '@backstage-community/plugin-stackstorm'; import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card'; import React, { ReactNode } from 'react'; import { Route } from 'react-router-dom'; diff --git a/packages/create-app/src/lib/versions.ts b/packages/create-app/src/lib/versions.ts index 76f3c37f78..febc68102c 100644 --- a/packages/create-app/src/lib/versions.ts +++ b/packages/create-app/src/lib/versions.ts @@ -61,9 +61,6 @@ import { version as pluginCatalogBackend } from '../../../../plugins/catalog-bac import { version as pluginCatalogBackendModuleScaffolderEntityModel } from '../../../../plugins/catalog-backend-module-scaffolder-entity-model/package.json'; import { version as pluginCatalogGraph } from '../../../../plugins/catalog-graph/package.json'; import { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json'; -import { version as pluginExplore } from '../../../../plugins/explore/package.json'; -import { version as pluginGithubActions } from '../../../../plugins/github-actions/package.json'; -import { version as pluginLighthouse } from '../../../../plugins/lighthouse/package.json'; import { version as pluginOrg } from '../../../../plugins/org/package.json'; import { version as pluginPermissionBackend } from '../../../../plugins/permission-backend/package.json'; import { version as pluginPermissionBackendModulePolicyAllowAll } from '../../../../plugins/permission-backend-module-policy-allow-all/package.json'; @@ -71,7 +68,6 @@ import { version as pluginPermissionCommon } from '../../../../plugins/permissio import { version as pluginPermissionReact } from '../../../../plugins/permission-react/package.json'; import { version as pluginPermissionNode } from '../../../../plugins/permission-node/package.json'; import { version as pluginProxyBackend } from '../../../../plugins/proxy-backend/package.json'; -import { version as pluginRollbarBackend } from '../../../../plugins/rollbar-backend/package.json'; import { version as pluginScaffolder } from '../../../../plugins/scaffolder/package.json'; import { version as pluginScaffolderBackend } from '../../../../plugins/scaffolder-backend/package.json'; import { version as pluginSearch } from '../../../../plugins/search/package.json'; @@ -81,7 +77,6 @@ import { version as pluginSearchBackendModuleCatalog } from '../../../../plugins import { version as pluginSearchBackendModulePg } from '../../../../plugins/search-backend-module-pg/package.json'; import { version as pluginSearchBackendModuleTechdocs } from '../../../../plugins/search-backend-module-techdocs/package.json'; import { version as pluginSearchBackendNode } from '../../../../plugins/search-backend-node/package.json'; -import { version as pluginTechRadar } from '../../../../plugins/tech-radar/package.json'; import { version as pluginTechdocs } from '../../../../plugins/techdocs/package.json'; import { version as pluginTechdocsReact } from '../../../../plugins/techdocs-react/package.json'; import { version as pluginTechdocsModuleAddonsContrib } from '../../../../plugins/techdocs-module-addons-contrib/package.json'; @@ -120,9 +115,6 @@ export const packageVersions = { pluginCatalogBackendModuleScaffolderEntityModel, '@backstage/plugin-catalog-graph': pluginCatalogGraph, '@backstage/plugin-catalog-import': pluginCatalogImport, - '@backstage/plugin-explore': pluginExplore, - '@backstage/plugin-github-actions': pluginGithubActions, - '@backstage/plugin-lighthouse': pluginLighthouse, '@backstage/plugin-org': pluginOrg, '@backstage/plugin-permission-backend': pluginPermissionBackend, '@backstage/plugin-permission-backend-module-allow-all-policy': @@ -131,7 +123,6 @@ export const packageVersions = { '@backstage/plugin-permission-node': pluginPermissionNode, '@backstage/plugin-permission-react': pluginPermissionReact, '@backstage/plugin-proxy-backend': pluginProxyBackend, - '@backstage/plugin-rollbar-backend': pluginRollbarBackend, '@backstage/plugin-scaffolder': pluginScaffolder, '@backstage/plugin-scaffolder-backend': pluginScaffolderBackend, '@backstage/plugin-search': pluginSearch, @@ -143,7 +134,6 @@ export const packageVersions = { '@backstage/plugin-search-backend-module-techdocs': pluginSearchBackendModuleTechdocs, '@backstage/plugin-search-backend-node': pluginSearchBackendNode, - '@backstage/plugin-tech-radar': pluginTechRadar, '@backstage/plugin-techdocs': pluginTechdocs, '@backstage/plugin-techdocs-react': pluginTechdocsReact, '@backstage/plugin-techdocs-module-addons-contrib': diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index a630cfe296..a686b952b5 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -80,6 +80,7 @@ "@testing-library/jest-dom": "^6.0.0", "@testing-library/react": "^15.0.0", "@testing-library/user-event": "^14.0.0", + "@types/highlightjs": "^10.1.0", "@types/swagger-ui-react": "^4.18.0" }, "peerDependencies": { diff --git a/packages/backend/src/plugins/nomad.ts b/plugins/api-docs/src/types.d.ts similarity index 64% rename from packages/backend/src/plugins/nomad.ts rename to plugins/api-docs/src/types.d.ts index 111cbfbf0d..ebc7e89e87 100644 --- a/packages/backend/src/plugins/nomad.ts +++ b/plugins/api-docs/src/types.d.ts @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Backstage Authors + * Copyright 2024 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. @@ -13,12 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { createRouter } from '@backstage/plugin-nomad-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - props: PluginEnvironment, -): Promise { - return await createRouter(props); -} +// highlight types are broken +declare module 'highlight.js/lib/core' {} diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index db2089a89e..8ddfda02d5 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -87,7 +87,8 @@ "@testing-library/dom": "^10.0.0", "@testing-library/jest-dom": "^6.0.0", "@testing-library/react": "^15.0.0", - "@testing-library/user-event": "^14.0.0" + "@testing-library/user-event": "^14.0.0", + "@types/pluralize": "^0.0.33" }, "peerDependencies": { "react": "^16.13.1 || ^17.0.0 || ^18.0.0", diff --git a/plugins/scaffolder-backend-module-github/package.json b/plugins/scaffolder-backend-module-github/package.json index 80d3445777..d1bec25994 100644 --- a/plugins/scaffolder-backend-module-github/package.json +++ b/plugins/scaffolder-backend-module-github/package.json @@ -58,7 +58,6 @@ "@backstage/plugin-scaffolder-node-test-utils": "workspace:^", "@types/libsodium-wrappers": "^0.7.10", "fs-extra": "^11.2.0", - "jest-when": "^3.1.0", "jsonschema": "^1.2.6" } } diff --git a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts index 02d6a2afaf..93927f72dc 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts @@ -41,7 +41,6 @@ import { GithubCredentialsProvider, ScmIntegrations, } from '@backstage/integration'; -import { when } from 'jest-when'; import { createPublishGithubAction } from './github'; import { initRepoAndPush } from '@backstage/plugin-scaffolder-node'; import { @@ -756,15 +755,9 @@ describe('publish:github', () => { }, }); - when(mockOctokit.rest.teams.addOrUpdateRepoPermissionsInOrg) - .calledWith({ - org: 'owner', - owner: 'owner', - repo: 'repo', - team_slug: 'robot-1', - permission: 'pull', - }) - .mockRejectedValueOnce(new Error('Something bad happened') as never); + mockOctokit.rest.teams.addOrUpdateRepoPermissionsInOrg.mockRejectedValueOnce( + new Error('Something bad happened'), + ); await action.handler({ ...mockContext, diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts b/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts index 25ddd176c1..65d49ce525 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubRepoCreate.test.ts @@ -30,7 +30,6 @@ import { GithubCredentialsProvider, ScmIntegrations, } from '@backstage/integration'; -import { when } from 'jest-when'; import { createGithubRepoCreateAction } from './githubRepoCreate'; import { entityRefToName } from './gitHelpers'; @@ -478,15 +477,9 @@ describe('github:repo:create', () => { }, }); - when(mockOctokit.rest.teams.addOrUpdateRepoPermissionsInOrg) - .calledWith({ - org: 'owner', - owner: 'owner', - repo: 'repo', - team_slug: 'robot-1', - permission: 'pull', - }) - .mockRejectedValueOnce(new Error('Something bad happened') as never); + mockOctokit.rest.teams.addOrUpdateRepoPermissionsInOrg.mockRejectedValueOnce( + new Error('Something bad happened'), + ); await action.handler({ ...mockContext, diff --git a/plugins/search-backend-module-explore/src/collators/ToolDocumentCollatorFactory.ts b/plugins/search-backend-module-explore/src/collators/ToolDocumentCollatorFactory.ts index 6606b4fb53..3a2f73c628 100644 --- a/plugins/search-backend-module-explore/src/collators/ToolDocumentCollatorFactory.ts +++ b/plugins/search-backend-module-explore/src/collators/ToolDocumentCollatorFactory.ts @@ -21,7 +21,7 @@ import { } from '@backstage/backend-common'; import { AuthService, LoggerService } from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; -import { ExploreTool } from '@backstage/plugin-explore-common'; +import { ExploreTool } from '@backstage-community/plugin-explore-common'; import { DocumentCollatorFactory, IndexableDocument, diff --git a/yarn.lock b/yarn.lock index 5961036a6b..faacbe8db9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4276,6 +4276,7 @@ __metadata: "@testing-library/jest-dom": ^6.0.0 "@testing-library/react": ^15.0.0 "@testing-library/user-event": ^14.0.0 + "@types/highlightjs": ^10.1.0 "@types/react": ^16.13.1 || ^17.0.0 || ^18.0.0 "@types/swagger-ui-react": ^4.18.0 graphiql: 3.1.1 @@ -4335,7 +4336,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-app-visualizer@workspace:plugins/app-visualizer": +"@backstage/plugin-app-visualizer@workspace:^, @backstage/plugin-app-visualizer@workspace:plugins/app-visualizer": version: 0.0.0-use.local resolution: "@backstage/plugin-app-visualizer@workspace:plugins/app-visualizer" dependencies: @@ -5463,6 +5464,7 @@ __metadata: "@testing-library/jest-dom": ^6.0.0 "@testing-library/react": ^15.0.0 "@testing-library/user-event": ^14.0.0 + "@types/pluralize": ^0.0.33 "@types/react": ^16.13.1 || ^17.0.0 || ^18.0.0 dataloader: ^2.0.0 expiry-map: ^2.0.0 @@ -5550,7 +5552,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-devtools@workspace:plugins/devtools": +"@backstage/plugin-devtools@workspace:^, @backstage/plugin-devtools@workspace:plugins/devtools": version: 0.0.0-use.local resolution: "@backstage/plugin-devtools@workspace:plugins/devtools" dependencies: @@ -6423,7 +6425,6 @@ __metadata: "@octokit/webhooks": ^10.0.0 "@types/libsodium-wrappers": ^0.7.10 fs-extra: ^11.2.0 - jest-when: ^3.1.0 jsonschema: ^1.2.6 libsodium-wrappers: ^0.7.11 octokit: ^3.0.0 @@ -15579,6 +15580,15 @@ __metadata: languageName: node linkType: hard +"@types/highlightjs@npm:^10.1.0": + version: 10.1.0 + resolution: "@types/highlightjs@npm:10.1.0" + dependencies: + highlight.js: ^10.1.0 + checksum: 454606bd5ba7425a845abce0bc3aa5fa0575e1047c97a4b7930d76dfced4fcc1985270ec88632cf45cdb0e266f589c362bb1591573bea730eacd08d3cf169747 + languageName: node + linkType: hard + "@types/hoist-non-react-statics@npm:^3.3.0": version: 3.3.1 resolution: "@types/hoist-non-react-statics@npm:3.3.1" @@ -16142,6 +16152,13 @@ __metadata: languageName: node linkType: hard +"@types/pluralize@npm:^0.0.33": + version: 0.0.33 + resolution: "@types/pluralize@npm:0.0.33" + checksum: 282d42dc0187e5e0912f9f36ee0f5615bfd273a08d40afe5bf5881cb28daf1977abe10564543032aa0f42352ebba739ff3d86bf5562ac4691c6d1761fcc7cf39 + languageName: node + linkType: hard + "@types/prettier@npm:^2.0.0": version: 2.7.3 resolution: "@types/prettier@npm:2.7.3" @@ -23732,11 +23749,14 @@ __metadata: "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" "@backstage/core-app-api": "workspace:^" + "@backstage/core-compat-api": "workspace:^" "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/frontend-app-api": "workspace:^" + "@backstage/frontend-plugin-api": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-api-docs": "workspace:^" + "@backstage/plugin-app-visualizer": "workspace:^" "@backstage/plugin-auth-react": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-common": "workspace:^" @@ -23816,6 +23836,7 @@ __metadata: "@backstage/plugin-catalog-import": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" "@backstage/plugin-catalog-unprocessed-entities": "workspace:^" + "@backstage/plugin-devtools": "workspace:^" "@backstage/plugin-home": "workspace:^" "@backstage/plugin-kubernetes": "workspace:^" "@backstage/plugin-kubernetes-cluster": "workspace:^" @@ -26080,7 +26101,7 @@ __metadata: languageName: node linkType: hard -"highlight.js@npm:^10.4.1, highlight.js@npm:^10.7.2, highlight.js@npm:~10.7.0": +"highlight.js@npm:^10.1.0, highlight.js@npm:^10.4.1, highlight.js@npm:^10.7.2, highlight.js@npm:~10.7.0": version: 10.7.3 resolution: "highlight.js@npm:10.7.3" checksum: defeafcd546b535d710d8efb8e650af9e3b369ef53e28c3dc7893eacfe263200bba4c5fcf43524ae66d5c0c296b1af0870523ceae3e3104d24b7abf6374a4fea