DevTools - Removed Deprecated Code

Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
Andre Wanlin
2024-10-31 19:33:33 -05:00
parent 1a03dc6f69
commit c781a9aefe
10 changed files with 15 additions and 75 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-devtools-backend': minor
---
**BREAKING** Removed support for what is known as the legacy backend, please use the New Backend System.
-1
View File
@@ -42,7 +42,6 @@
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^",
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^",
"@backstage/plugin-devtools-backend": "workspace:^",
"@backstage/plugin-events-backend": "workspace:^",
"@backstage/plugin-events-node": "workspace:^",
"@backstage/plugin-kubernetes-backend": "workspace:^",
-3
View File
@@ -48,7 +48,6 @@ import techdocs from './plugins/techdocs';
import app from './plugins/app';
import permission from './plugins/permission';
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';
@@ -138,7 +137,6 @@ async function main() {
const appEnv = useHotMemoize(module, () => createEnv('app'));
const permissionEnv = useHotMemoize(module, () => createEnv('permission'));
const eventsEnv = useHotMemoize(module, () => createEnv('events'));
const devToolsEnv = useHotMemoize(module, () => createEnv('devtools'));
const signalsEnv = useHotMemoize(module, () => createEnv('signals'));
const apiRouter = Router();
@@ -151,7 +149,6 @@ async function main() {
apiRouter.use('/kubernetes', await kubernetes(kubernetesEnv));
apiRouter.use('/proxy', await proxy(proxyEnv));
apiRouter.use('/permission', await permission(permissionEnv));
apiRouter.use('/devtools', await devtools(devToolsEnv));
apiRouter.use('/signals', await signals(signalsEnv));
apiRouter.use(notFoundHandler());
@@ -1,30 +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-devtools-backend';
import { Router } from 'express';
import type { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return createRouter({
logger: env.logger,
config: env.config,
permissions: env.permissions,
discovery: env.discovery,
});
}
+1 -1
View File
@@ -38,7 +38,7 @@
"test": "backstage-cli package test"
},
"dependencies": {
"@backstage/backend-common": "^0.25.0",
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/cli-common": "workspace:^",
"@backstage/config": "workspace:^",
-24
View File
@@ -7,16 +7,8 @@ import { BackendFeature } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import { ConfigInfo } from '@backstage/plugin-devtools-common';
import { DevToolsInfo } from '@backstage/plugin-devtools-common';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import express from 'express';
import { ExternalDependency } from '@backstage/plugin-devtools-common';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PermissionsService } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public (undocumented)
export class DevToolsBackendApi {
@@ -32,20 +24,4 @@ export class DevToolsBackendApi {
// @public
const devtoolsPlugin: BackendFeature;
export default devtoolsPlugin;
// @public @deprecated (undocumented)
export interface RouterOptions {
// (undocumented)
config: RootConfigService;
// (undocumented)
devToolsBackendApi?: DevToolsBackendApi;
// (undocumented)
discovery: DiscoveryService;
// (undocumented)
httpAuth?: HttpAuthService;
// (undocumented)
logger: LoggerService;
// (undocumented)
permissions: PermissionsService;
}
```
-1
View File
@@ -21,5 +21,4 @@
*/
export { DevToolsBackendApi } from './api';
export * from './service/router';
export { devtoolsPlugin as default } from './plugin';
@@ -51,6 +51,7 @@ describe('createRouter', () => {
}),
discovery: mockServices.discovery(),
permissions: permissionEvaluator,
httpAuth: mockServices.httpAuth(),
});
app = express().use(router);
});
+8 -13
View File
@@ -24,10 +24,6 @@ import {
import { DevToolsBackendApi } from '../api';
import { NotAllowedError } from '@backstage/errors';
import Router from 'express-promise-router';
import {
createLegacyAuthAdapters,
errorHandler,
} from '@backstage/backend-common';
import express from 'express';
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
import {
@@ -37,10 +33,10 @@ import {
PermissionsService,
RootConfigService,
} from '@backstage/backend-plugin-api';
import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
* @internal
*/
export interface RouterOptions {
devToolsBackendApi?: DevToolsBackendApi;
@@ -48,19 +44,16 @@ export interface RouterOptions {
config: RootConfigService;
permissions: PermissionsService;
discovery: DiscoveryService;
httpAuth?: HttpAuthService;
httpAuth: HttpAuthService;
}
/**
* @deprecated Please migrate to the new backend system as this will be removed in the future.
* @public
* @internal
* */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
const { logger, config, permissions } = options;
const { httpAuth } = createLegacyAuthAdapters(options);
const { logger, config, permissions, httpAuth } = options;
const devToolsBackendApi =
options.devToolsBackendApi || new DevToolsBackendApi(logger, config);
@@ -128,6 +121,8 @@ export async function createRouter(
response.status(200).json(health);
});
router.use(errorHandler());
const middleware = MiddlewareFactory.create({ logger, config });
router.use(middleware.error());
return router;
}
-2
View File
@@ -6510,7 +6510,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@backstage/plugin-devtools-backend@workspace:plugins/devtools-backend"
dependencies:
"@backstage/backend-common": ^0.25.0
"@backstage/backend-defaults": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
@@ -27494,7 +27493,6 @@ __metadata:
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^"
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
"@backstage/plugin-devtools-backend": "workspace:^"
"@backstage/plugin-events-backend": "workspace:^"
"@backstage/plugin-events-node": "workspace:^"
"@backstage/plugin-kubernetes-backend": "workspace:^"