From 27f44f4ad834ec39f37127cb54b34e760291ec1b Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 16 Jan 2023 01:09:29 +0100 Subject: [PATCH] events-backend-module-github: migrate to use exports Signed-off-by: Patrik Oldsberg --- .../alpha-api-report.md | 17 ++++++++++++++ .../api-report.md | 7 ------ .../events-backend-module-github/package.json | 22 ++++++++++++++----- .../events-backend-module-github/src/alpha.ts | 18 +++++++++++++++ .../events-backend-module-github/src/index.ts | 2 -- .../GithubEventRouterEventsModule.test.ts | 2 +- .../service/GithubEventRouterEventsModule.ts | 2 +- .../service/GithubWebhookEventsModule.test.ts | 2 +- .../src/service/GithubWebhookEventsModule.ts | 2 +- 9 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 plugins/events-backend-module-github/alpha-api-report.md create mode 100644 plugins/events-backend-module-github/src/alpha.ts diff --git a/plugins/events-backend-module-github/alpha-api-report.md b/plugins/events-backend-module-github/alpha-api-report.md new file mode 100644 index 0000000000..aed740ed0d --- /dev/null +++ b/plugins/events-backend-module-github/alpha-api-report.md @@ -0,0 +1,17 @@ +## API Report File for "@backstage/plugin-events-backend-module-github" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackendFeature } from '@backstage/backend-plugin-api'; + +// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/plugin-events-backend-module-github" does not have an export "GithubEventRouter" +// +// @alpha +export const githubEventRouterEventsModule: () => BackendFeature; + +// @alpha +export const githubWebhookEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-github/api-report.md b/plugins/events-backend-module-github/api-report.md index 4f14bce789..bcf9b8ed74 100644 --- a/plugins/events-backend-module-github/api-report.md +++ b/plugins/events-backend-module-github/api-report.md @@ -3,7 +3,6 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { BackendFeature } from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; import { EventParams } from '@backstage/plugin-events-node'; import { RequestValidator } from '@backstage/plugin-events-node'; @@ -20,10 +19,4 @@ export class GithubEventRouter extends SubTopicEventRouter { // (undocumented) protected determineSubTopic(params: EventParams): string | undefined; } - -// @alpha -export const githubEventRouterEventsModule: () => BackendFeature; - -// @alpha -export const githubWebhookEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-github/package.json b/plugins/events-backend-module-github/package.json index 1d266ea562..3145ee9e66 100644 --- a/plugins/events-backend-module-github/package.json +++ b/plugins/events-backend-module-github/package.json @@ -5,17 +5,28 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "alphaTypes": "dist/index.alpha.d.ts", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts" + }, + "typesVersions": { + "*": { + "*": [ + "src/index.ts" + ], + "alpha": [ + "src/alpha.ts" + ] + } }, "backstage": { "role": "backend-plugin-module" }, "scripts": { "start": "backstage-cli package start", - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "clean": "backstage-cli package clean", @@ -36,7 +47,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/events-backend-module-github/src/alpha.ts b/plugins/events-backend-module-github/src/alpha.ts new file mode 100644 index 0000000000..8a712cacb1 --- /dev/null +++ b/plugins/events-backend-module-github/src/alpha.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { githubEventRouterEventsModule } from './service/GithubEventRouterEventsModule'; +export { githubWebhookEventsModule } from './service/GithubWebhookEventsModule'; diff --git a/plugins/events-backend-module-github/src/index.ts b/plugins/events-backend-module-github/src/index.ts index 8e5671d9d8..d02ea1deaf 100644 --- a/plugins/events-backend-module-github/src/index.ts +++ b/plugins/events-backend-module-github/src/index.ts @@ -23,5 +23,3 @@ export { createGithubSignatureValidator } from './http/createGithubSignatureValidator'; export { GithubEventRouter } from './router/GithubEventRouter'; -export { githubEventRouterEventsModule } from './service/GithubEventRouterEventsModule'; -export { githubWebhookEventsModule } from './service/GithubWebhookEventsModule'; diff --git a/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.test.ts b/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.test.ts index 694f5e1dbe..0e2ca69366 100644 --- a/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.test.ts +++ b/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.test.ts @@ -15,7 +15,7 @@ */ import { startTestBackend } from '@backstage/backend-test-utils'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { githubEventRouterEventsModule } from './GithubEventRouterEventsModule'; import { GithubEventRouter } from '../router/GithubEventRouter'; diff --git a/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts b/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts index 8914d07e71..e2e6fab266 100644 --- a/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts +++ b/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts @@ -15,7 +15,7 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { GithubEventRouter } from '../router/GithubEventRouter'; /** diff --git a/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.test.ts b/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.test.ts index 84233eedee..9e33cac6a0 100644 --- a/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.test.ts +++ b/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.test.ts @@ -17,8 +17,8 @@ import { coreServices } from '@backstage/backend-plugin-api'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { - eventsExtensionPoint, HttpPostIngressOptions, RequestDetails, } from '@backstage/plugin-events-node'; diff --git a/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.ts b/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.ts index 9a3202cb97..10cb12e431 100644 --- a/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.ts +++ b/plugins/events-backend-module-github/src/service/GithubWebhookEventsModule.ts @@ -18,7 +18,7 @@ import { coreServices, createBackendModule, } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { createGithubSignatureValidator } from '../http/createGithubSignatureValidator'; /**