diff --git a/workspaces/azure-devops/.changeset/lazy-poems-call.md b/workspaces/azure-devops/.changeset/lazy-poems-call.md new file mode 100644 index 0000000000..a4022c2fcc --- /dev/null +++ b/workspaces/azure-devops/.changeset/lazy-poems-call.md @@ -0,0 +1,5 @@ +--- +'@backstage-community/plugin-scaffolder-backend-module-azure-devops': patch +--- + +Updated code with proper TSDoc comments to generate API Reports diff --git a/workspaces/azure-devops/.changeset/odd-masks-whisper.md b/workspaces/azure-devops/.changeset/odd-masks-whisper.md new file mode 100644 index 0000000000..8dd6b92f82 --- /dev/null +++ b/workspaces/azure-devops/.changeset/odd-masks-whisper.md @@ -0,0 +1,5 @@ +--- +'@backstage-community/plugin-azure-devops-backend': minor +--- + +**BREAKING** Removed support for what is known as the legacy backend, please use the New Backend System. Also removed the long deprecated `azureDevOps.token` configuration option, use `integrations.azure` instead. diff --git a/workspaces/azure-devops/package.json b/workspaces/azure-devops/package.json index 98685f4af4..647d1c692a 100644 --- a/workspaces/azure-devops/package.json +++ b/workspaces/azure-devops/package.json @@ -22,7 +22,7 @@ "prettier:write": "prettier --write .", "new": "backstage-cli new --scope @backstage-community", "build:api-reports": "yarn build:api-reports:only --tsc", - "build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type, ae-undocumented --validate-release-tags", + "build:api-reports:only": "backstage-repo-tools api-reports -o ae-wrong-input-file-type,ae-undocumented --validate-release-tags", "build:knip-reports": "backstage-repo-tools knip-reports", "postinstall": "cd ../../ && yarn install" }, diff --git a/workspaces/azure-devops/packages/backend/knip-report.md b/workspaces/azure-devops/packages/backend/knip-report.md index ca67205691..257e0937d5 100644 --- a/workspaces/azure-devops/packages/backend/knip-report.md +++ b/workspaces/azure-devops/packages/backend/knip-report.md @@ -10,7 +10,6 @@ | @backstage/plugin-permission-common | package.json | error | | @backstage/plugin-permission-node | package.json | error | | @backstage/plugin-auth-node | package.json | error | -| @backstage/backend-common | package.json | error | | @backstage/backend-tasks | package.json | error | | @backstage/config | package.json | error | | better-sqlite3 | package.json | error | diff --git a/workspaces/azure-devops/packages/backend/package.json b/workspaces/azure-devops/packages/backend/package.json index 2b265be997..beeb713988 100644 --- a/workspaces/azure-devops/packages/backend/package.json +++ b/workspaces/azure-devops/packages/backend/package.json @@ -24,7 +24,6 @@ "@backstage-community/plugin-azure-devops-backend": "workspace:^", "@backstage-community/plugin-catalog-backend-module-azure-devops-annotator-processor": "workspace:^", "@backstage-community/plugin-scaffolder-backend-module-azure-devops": "workspace:^", - "@backstage/backend-common": "^0.23.3", "@backstage/backend-defaults": "^0.5.2", "@backstage/backend-tasks": "^0.6.1", "@backstage/config": "^1.2.0", diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/README.md b/workspaces/azure-devops/plugins/azure-devops-backend/README.md index 7d1dad2a8a..f1a6a2fd42 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/README.md +++ b/workspaces/azure-devops/plugins/azure-devops-backend/README.md @@ -34,51 +34,10 @@ Here's how to get the backend up and running: 1. First we need to add the `@backstage-community/plugin-azure-devops-backend` package to your backend: ```sh - # From your Backstage root directory yarn --cwd packages/backend add @backstage-community/plugin-azure-devops-backend ``` -2. Then we will create a new file named `packages/backend/src/plugins/azure-devops.ts`, and add the - following to it: - - ```ts - import { createRouter } from '@backstage-community/plugin-azure-devops-backend'; - import { Router } from 'express'; - import type { PluginEnvironment } from '../types'; - - export default function createPlugin( - env: PluginEnvironment, - ): Promise { - return createRouter({ - logger: env.logger, - config: env.config, - reader: env.reader, - }); - } - ``` - -3. Next we wire this into the overall backend router, edit `packages/backend/src/index.ts`: - - ```ts - import azureDevOps from './plugins/azure-devops'; - // ... - async function main() { - // ... - // Add this line under the other lines that follow the useHotMemoize pattern - const azureDevOpsEnv = useHotMemoize(module, () => createEnv('azure-devops')); - // ... - // Insert this line under the other lines that add their routers to apiRouter in the same way - apiRouter.use('/azure-devops', await azureDevOps(azureDevOpsEnv)); - ``` - -4. Now run `yarn start-backend` from the repo root -5. Finally open `http://localhost:7007/api/azure-devops/health` in a browser and it should return `{"status":"ok"}` - -#### New Backend System - -The Azure DevOps backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up: - -In your `packages/backend/src/index.ts` make the following changes: +2. Then in your `packages/backend/src/index.ts` make the following changes: ```diff import { createBackend } from '@backstage/backend-defaults'; diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/config.d.ts b/workspaces/azure-devops/plugins/azure-devops-backend/config.d.ts index b79cd1d058..205f6bd5e8 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/config.d.ts +++ b/workspaces/azure-devops/plugins/azure-devops-backend/config.d.ts @@ -23,12 +23,6 @@ export interface Config { * The hostname of the given Azure instance */ host: string; - /** - * Token used to authenticate requests. - * @visibility secret - * @deprecated Use `integrations.azure` instead, see {@link https://backstage.io/docs/integrations/azure/locations} - */ - token?: string; /** * The organization of the given Azure instance */ diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/package.json b/workspaces/azure-devops/plugins/azure-devops-backend/package.json index ae4f46cd23..e9d74a854c 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/package.json +++ b/workspaces/azure-devops/plugins/azure-devops-backend/package.json @@ -35,7 +35,6 @@ }, "dependencies": { "@backstage-community/plugin-azure-devops-common": "workspace:^", - "@backstage/backend-common": "^0.25.0", "@backstage/backend-defaults": "^0.5.2", "@backstage/backend-plugin-api": "^1.0.1", "@backstage/catalog-model": "^1.7.0", diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/report.api.md b/workspaces/azure-devops/plugins/azure-devops-backend/report.api.md index 75623c2982..e0b3b9c4ba 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/report.api.md +++ b/workspaces/azure-devops/plugins/azure-devops-backend/report.api.md @@ -9,13 +9,9 @@ import { BuildDefinitionReference } from 'azure-devops-node-api/interfaces/Build import { BuildRun } from '@backstage-community/plugin-azure-devops-common'; import { Config } from '@backstage/config'; import { DashboardPullRequest } from '@backstage-community/plugin-azure-devops-common'; -import { DiscoveryService } from '@backstage/backend-plugin-api'; -import express from 'express'; import { GitRepository } from 'azure-devops-node-api/interfaces/GitInterfaces'; import { GitTag } from '@backstage-community/plugin-azure-devops-common'; -import { HttpAuthService } from '@backstage/backend-plugin-api'; import { LoggerService } from '@backstage/backend-plugin-api'; -import { PermissionsService } from '@backstage/backend-plugin-api'; import { Project } from '@backstage-community/plugin-azure-devops-common'; import { PullRequest } from '@backstage-community/plugin-azure-devops-common'; import { PullRequestOptions } from '@backstage-community/plugin-azure-devops-common'; @@ -127,25 +123,4 @@ export class AzureDevOpsApi { // @public const azureDevOpsPlugin: BackendFeature; export default azureDevOpsPlugin; - -// @public @deprecated (undocumented) -export function createRouter(options: RouterOptions): Promise; - -// @public @deprecated (undocumented) -export interface RouterOptions { - // (undocumented) - azureDevOpsApi?: AzureDevOpsApi; - // (undocumented) - config: Config; - // (undocumented) - discovery: DiscoveryService; - // (undocumented) - httpAuth?: HttpAuthService; - // (undocumented) - logger: LoggerService; - // (undocumented) - permissions: PermissionsService; - // (undocumented) - reader: UrlReaderService; -} ``` diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/src/index.ts b/workspaces/azure-devops/plugins/azure-devops-backend/src/index.ts index 3c802e7144..c2b30767f0 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/src/index.ts +++ b/workspaces/azure-devops/plugins/azure-devops-backend/src/index.ts @@ -21,5 +21,4 @@ */ export { AzureDevOpsApi } from './api'; -export * from './service/router'; export { azureDevOpsPlugin as default } from './plugin'; diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/src/plugin.ts b/workspaces/azure-devops/plugins/azure-devops-backend/src/plugin.ts index 7bf724e64b..99c70b4c30 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/src/plugin.ts +++ b/workspaces/azure-devops/plugins/azure-devops-backend/src/plugin.ts @@ -35,7 +35,6 @@ export const azureDevOpsPlugin = createBackendPlugin({ reader: coreServices.urlReader, permissions: coreServices.permissions, httpRouter: coreServices.httpRouter, - discovery: coreServices.discovery, httpAuth: coreServices.httpAuth, }, async init({ @@ -44,7 +43,6 @@ export const azureDevOpsPlugin = createBackendPlugin({ reader, permissions, httpRouter, - discovery, httpAuth, }) { httpRouter.use( @@ -53,7 +51,6 @@ export const azureDevOpsPlugin = createBackendPlugin({ logger, reader, permissions, - discovery, httpAuth, }), ); diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.test.ts b/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.test.ts index c180b29c35..393508625a 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.test.ts +++ b/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.test.ts @@ -101,7 +101,7 @@ describe('createRouter', () => { azureDevOpsApi, reader: mockUrlReader, permissions: mockPermissionEvaluator, - discovery: mockServices.discovery(), + httpAuth: mockServices.httpAuth(), }); app = express().use(router); diff --git a/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.ts b/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.ts index 1fecc53f96..fe65fdd0ca 100644 --- a/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.ts +++ b/workspaces/azure-devops/plugins/azure-devops-backend/src/service/router.ts @@ -32,14 +32,12 @@ import { PullRequestsDashboardProvider, } from '../api/PullRequestsDashboardProvider'; import Router from 'express-promise-router'; -import { createLegacyAuthAdapters } from '@backstage/backend-common'; import { UrlReaderService } from '@backstage/backend-plugin-api'; import express from 'express'; import { InputError, NotAllowedError } from '@backstage/errors'; import { AuthorizeResult } from '@backstage/plugin-permission-common'; import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node'; import { - DiscoveryService, HttpAuthService, LoggerService, PermissionsService, @@ -49,8 +47,7 @@ import { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter'; const DEFAULT_TOP = 10; /** - * @deprecated Please migrate to the new backend system as this will be removed in the future. - * @public + * @internal * */ export interface RouterOptions { azureDevOpsApi?: AzureDevOpsApi; @@ -58,26 +55,16 @@ export interface RouterOptions { config: Config; reader: UrlReaderService; 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 { - const { logger, reader, config, permissions } = options; - - const { httpAuth } = createLegacyAuthAdapters(options); - - if (config.getOptionalString('azureDevOps.token')) { - logger.warn( - "The 'azureDevOps.token' has been deprecated, use 'integrations.azure' instead, for more details see: https://backstage.io/docs/integrations/azure/locations", - ); - } + const { logger, reader, config, permissions, httpAuth } = options; const permissionIntegrationRouter = createPermissionIntegrationRouter({ permissions: azureDevOpsPermissions, diff --git a/workspaces/azure-devops/plugins/catalog-backend-module-azure-devops-annotator-processor/knip-report.md b/workspaces/azure-devops/plugins/catalog-backend-module-azure-devops-annotator-processor/knip-report.md index fb1a5b28a9..e4ba7e5dbb 100644 --- a/workspaces/azure-devops/plugins/catalog-backend-module-azure-devops-annotator-processor/knip-report.md +++ b/workspaces/azure-devops/plugins/catalog-backend-module-azure-devops-annotator-processor/knip-report.md @@ -5,7 +5,6 @@ | Name | Location | Severity | | :---------------------------------------------- | :----------- | :------- | | @backstage-community/plugin-azure-devops-common | package.json | error | -| @backstage/backend-common | package.json | error | ## Unused devDependencies (1) diff --git a/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/report.api.md b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/report.api.md new file mode 100644 index 0000000000..6eae8e0ff3 --- /dev/null +++ b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/report.api.md @@ -0,0 +1,11 @@ +## API Report File for "@backstage-community/plugin-scaffolder-backend-module-azure-devops" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackendFeatureCompat } from '@backstage/backend-plugin-api'; + +// @public +const scaffolderModule: BackendFeatureCompat; +export default scaffolderModule; +``` diff --git a/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/index.ts b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/index.ts index e46bea01b5..da9a93c15d 100644 --- a/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/index.ts +++ b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/index.ts @@ -15,7 +15,7 @@ */ /** - * The azure-devops module for @backstage/plugin-scaffolder-backend. + * The azure-devops module for the Scaffolder. * * @packageDocumentation */ diff --git a/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/module.ts b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/module.ts index 0234b8a279..20e3141c2e 100644 --- a/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/module.ts +++ b/workspaces/azure-devops/plugins/scaffolder-backend-module-azure-devops/src/module.ts @@ -23,6 +23,7 @@ import { ScmIntegrations } from '@backstage/integration'; /** * A backend module that registers the action into the scaffolder + * @public */ export const scaffolderModule = createBackendModule({ moduleId: 'azure-devops', diff --git a/workspaces/azure-devops/yarn.lock b/workspaces/azure-devops/yarn.lock index 1d8da760bc..3b99a05048 100644 --- a/workspaces/azure-devops/yarn.lock +++ b/workspaces/azure-devops/yarn.lock @@ -2662,7 +2662,6 @@ __metadata: resolution: "@backstage-community/plugin-azure-devops-backend@workspace:plugins/azure-devops-backend" dependencies: "@backstage-community/plugin-azure-devops-common": "workspace:^" - "@backstage/backend-common": ^0.25.0 "@backstage/backend-defaults": ^0.5.2 "@backstage/backend-plugin-api": ^1.0.1 "@backstage/backend-test-utils": ^1.0.2 @@ -15420,7 +15419,6 @@ __metadata: "@backstage-community/plugin-azure-devops-backend": "workspace:^" "@backstage-community/plugin-catalog-backend-module-azure-devops-annotator-processor": "workspace:^" "@backstage-community/plugin-scaffolder-backend-module-azure-devops": "workspace:^" - "@backstage/backend-common": ^0.23.3 "@backstage/backend-defaults": ^0.5.2 "@backstage/backend-tasks": ^0.6.1 "@backstage/cli": ^0.28.0