diff --git a/.changeset/curvy-pets-hang.md b/.changeset/curvy-pets-hang.md new file mode 100644 index 0000000000..3a2d11ac12 --- /dev/null +++ b/.changeset/curvy-pets-hang.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Tweaked type dependency check to trim wildcard type imports. diff --git a/.changeset/long-nails-pump.md b/.changeset/long-nails-pump.md new file mode 100644 index 0000000000..d9eefc0249 --- /dev/null +++ b/.changeset/long-nails-pump.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Added a new `migrate package-exports` command that synchronizes package exports fields in all `package.json`s. diff --git a/.changeset/rare-grapes-count.md b/.changeset/rare-grapes-count.md new file mode 100644 index 0000000000..fdeb653f3c --- /dev/null +++ b/.changeset/rare-grapes-count.md @@ -0,0 +1,45 @@ +--- +'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch +'@backstage/plugin-catalog-backend-module-bitbucket-server': patch +'@backstage/plugin-catalog-backend-module-bitbucket-cloud': patch +'@backstage/plugin-events-backend-module-bitbucket-cloud': patch +'@backstage/plugin-catalog-backend-module-msgraph': patch +'@backstage/plugin-catalog-backend-module-gerrit': patch +'@backstage/plugin-catalog-backend-module-github': patch +'@backstage/plugin-catalog-backend-module-gitlab': patch +'@backstage/plugin-events-backend-module-aws-sqs': patch +'@backstage/plugin-catalog-backend-module-azure': patch +'@backstage/plugin-events-backend-module-gerrit': patch +'@backstage/plugin-events-backend-module-github': patch +'@backstage/plugin-events-backend-module-gitlab': patch +'@backstage/plugin-events-backend-module-azure': patch +'@backstage/plugin-catalog-backend-module-aws': patch +'@backstage/backend-plugin-api': patch +'@backstage/backend-test-utils': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/backend-defaults': patch +'@backstage/backend-app-api': patch +'@backstage/core-plugin-api': patch +'@backstage/plugin-scaffolder-react': patch +'@backstage/plugin-techdocs-backend': patch +'@backstage/backend-common': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-sonarqube-react': patch +'@backstage/catalog-model': patch +'@backstage/plugin-catalog-common': patch +'@backstage/plugin-events-backend': patch +'@backstage/plugin-jenkins-common': patch +'@backstage/plugin-techdocs-react': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-cost-insights': patch +'@backstage/plugin-catalog-node': patch +'@backstage/test-utils': patch +'@backstage/plugin-app-backend': patch +'@backstage/plugin-events-node': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-sonarqube': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-jenkins': patch +--- + +Internal refactor of `/alpha` exports. diff --git a/.changeset/yellow-bananas-yawn.md b/.changeset/yellow-bananas-yawn.md new file mode 100644 index 0000000000..d9c522a429 --- /dev/null +++ b/.changeset/yellow-bananas-yawn.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +The API report generation process is now able to detect and generate reports for additional entry points declared in the package `"exports"` field. diff --git a/.prettierignore b/.prettierignore index 8f1fae0456..ad2bd355ed 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,6 +5,7 @@ coverage *.hbs templates api-report.md +*-api-report.md cli-report.md plugins/scaffolder-backend/sample-templates .vscode diff --git a/docs/local-dev/cli-build-system.md b/docs/local-dev/cli-build-system.md index cf8ac626b9..2eb695e3a3 100644 --- a/docs/local-dev/cli-build-system.md +++ b/docs/local-dev/cli-build-system.md @@ -650,8 +650,34 @@ The following is an excerpt of a typical setup of an isomorphic library package: "files": ["dist"], ``` +## Subpath Exports + +The Backstage CLI supports implementation of subpath exports through the `"exports"` field in `package.json`. It might for example look like this: + +```json + "name": "@backstage/plugin-foo", + "exports": { + ".": "./src/index.ts", + "./components": "./src/components.ts", + }, +``` + +This in turn would allow you to import anything exported in `src/index.ts` via `@backstage/plugins-foo`, and `src/components.ts` via `@backstage/plugins-foo/components`. Note that patterns are not supported, meaning the exports may not contain `*` wildcards. + +As with the rest of the Backstage CLI build system, the setup is optimized for local development, which is why the `"exports"` targets point directly to source files. The `package build` command will detect the `"exports"` field and automatically generate the corresponding `dist` files, and the `prepublish` command will rewrite the `"exports"` field to point to the `dist` files, as well as generating folder-based entry points for backwards compatibility. + +TypeScript support is currently handled though the `typesVersions` field, as there is not yet a module resolution mode that works well with `"exports"`. You can craft the `typesVersions` yourself, but it will also be automatically generated by the `migrate package-exports` command. + +To add subpath exports to an existing package, simply add the desired `"exports"` fields and then run the following command: + +```bash +yarn backstage-cli package migrate package-exports +``` + ## Experimental Type Build +> Note: Experimental type builds are deprecated and will be removed in the future. They have been replaced by [subpath exports](#subpath-exports). + The Backstage CLI has an experimental feature where multiple different type definition files can be generated for different release stages. The release stages are marked in the [TSDoc](https://tsdoc.org/) for each individual export, using either `@public`, `@alpha`, or `@beta`. Rather than just building a single `index.d.ts` file, the build process will instead output `index.d.ts`, `index.beta.d.ts`, and `index.alpha.d.ts`. Each of these files will have exports from more unstable release stages stripped, meaning that `index.d.ts` will omit all exports marked with `@alpha` or `@beta`, while `index.beta.d.ts` will omit all exports marked with `@alpha`. This feature is aimed at projects that publish to package registries and wish to maintain different levels of API stability within each package. There is no need to use this within a single monorepo, as it has no effect due to only applying to built and published packages. diff --git a/docs/local-dev/cli-commands.md b/docs/local-dev/cli-commands.md index b43825d733..e34dd63295 100644 --- a/docs/local-dev/cli-commands.md +++ b/docs/local-dev/cli-commands.md @@ -120,7 +120,6 @@ Build a package for production deployment or publishing Options: --role <name> Run the command with an explicit package role --minify Minify the generated code. Does not apply to app or backend packages. - --experimental-type-build Enable experimental type build. Does not apply to app or backend packages. --skip-build-dependencies Skip the automatic building of local dependencies. Applies to backend packages only. --stats If bundle stats are available, write them to the output directory. Applies to app packages only. --config <path> Config files to load instead of app-config.yaml. Applies to app packages only. (default: []) diff --git a/package.json b/package.json index 5383ba3d51..c06d353501 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build:backend": "yarn workspace backend build", "build:all": "backstage-cli repo build --all", "build:api-reports": "yarn build:api-reports:only --tsc", - "build:api-reports:only": "backstage-repo-tools api-reports --allow-warnings 'packages/core-components,plugins/+(catalog|catalog-import|git-release-manager|jenkins|kubernetes)' -o ae-wrong-input-file-type", + "build:api-reports:only": "backstage-repo-tools api-reports --allow-warnings 'packages/core-components,plugins/+(catalog|catalog-import|git-release-manager|jenkins|kubernetes)' -o ae-wrong-input-file-type --validate-release-tags", "build:api-docs": "LANG=en_EN yarn build:api-reports --docs", "tsc": "tsc", "tsc:full": "backstage-cli repo clean && tsc --skipLibCheck false --incremental false", diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index dfd2437b6b..4dacbbc007 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -59,9 +59,9 @@ import { GraphiQLPage } from '@backstage/plugin-graphiql'; import { HomepageCompositionRoot } from '@backstage/plugin-home'; import { LighthousePage } from '@backstage/plugin-lighthouse'; import { NewRelicPage } from '@backstage/plugin-newrelic'; +import { NextScaffolderPage } from '@backstage/plugin-scaffolder/alpha'; import { ScaffolderPage, - NextScaffolderPage, scaffolderPlugin, ScaffolderLayouts, } from '@backstage/plugin-scaffolder'; @@ -104,7 +104,7 @@ 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'; +import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha'; import { PlaylistIndexPage } from '@backstage/plugin-playlist'; import { TwoColumnLayout } from './components/scaffolder/customScaffolderLayouts'; import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card'; diff --git a/packages/app/src/components/scaffolder/customScaffolderExtensions.tsx b/packages/app/src/components/scaffolder/customScaffolderExtensions.tsx index 8a2e7fba53..b15d12979a 100644 --- a/packages/app/src/components/scaffolder/customScaffolderExtensions.tsx +++ b/packages/app/src/components/scaffolder/customScaffolderExtensions.tsx @@ -17,10 +17,11 @@ import React from 'react'; import type { FieldValidation } from '@rjsf/utils'; import { scaffolderPlugin } from '@backstage/plugin-scaffolder'; import { TextField } from '@material-ui/core'; - import { NextFieldExtensionComponentProps, createNextScaffolderFieldExtension, +} from '@backstage/plugin-scaffolder-react/alpha'; +import { createScaffolderFieldExtension, FieldExtensionComponentProps, } from '@backstage/plugin-scaffolder-react'; diff --git a/packages/backend-app-api/package.json b/packages/backend-app-api/package.json index f6672f1fbb..9c105fb474 100644 --- a/packages/backend-app-api/package.json +++ b/packages/backend-app-api/package.json @@ -7,8 +7,7 @@ "publishConfig": { "access": "public", "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "types": "dist/index.d.ts" }, "backstage": { "role": "node-library" @@ -24,7 +23,7 @@ ], "license": "Apache-2.0", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", diff --git a/packages/backend-common/alpha-api-report.md b/packages/backend-common/alpha-api-report.md new file mode 100644 index 0000000000..9d60b68b6b --- /dev/null +++ b/packages/backend-common/alpha-api-report.md @@ -0,0 +1,32 @@ +## API Report File for "@backstage/backend-common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { Duration } from 'luxon'; + +// @alpha +export interface Context { + readonly abortSignal: AbortSignal; + readonly deadline: Date | undefined; + value(key: string): T | undefined; +} + +// @alpha +export class Contexts { + static root(): Context; + static withAbort( + parentCtx: Context, + source: AbortController | AbortSignal, + ): Context; + static withTimeoutDuration(parentCtx: Context, timeout: Duration): Context; + static withTimeoutMillis(parentCtx: Context, timeout: number): Context; + static withValue( + parentCtx: Context, + key: string, + value: unknown | ((previous: unknown | undefined) => unknown), + ): Context; +} + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index d21ef30a0b..1cde27877b 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -20,7 +20,6 @@ import { Config } from '@backstage/config'; import { ConfigService } from '@backstage/backend-plugin-api'; import cors from 'cors'; import Docker from 'dockerode'; -import { Duration } from 'luxon'; import { ErrorRequestHandler } from 'express'; import express from 'express'; import { GerritIntegration } from '@backstage/integration'; @@ -211,29 +210,6 @@ export interface ContainerRunner { runContainer(opts: RunContainerOptions): Promise; } -// @alpha -export interface Context { - readonly abortSignal: AbortSignal; - readonly deadline: Date | undefined; - value(key: string): T | undefined; -} - -// @alpha -export class Contexts { - static root(): Context; - static withAbort( - parentCtx: Context, - source: AbortController | AbortSignal, - ): Context; - static withTimeoutDuration(parentCtx: Context, timeout: Duration): Context; - static withTimeoutMillis(parentCtx: Context, timeout: number): Context; - static withValue( - parentCtx: Context, - key: string, - value: unknown | ((previous: unknown | undefined) => unknown), - ): Context; -} - // @public export function createDatabaseClient( dbConfig: Config, diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index d356d67fab..7973ae6111 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -5,10 +5,22 @@ "main": "src/index.ts", "types": "src/index.ts", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "node-library" @@ -24,7 +36,7 @@ ], "license": "Apache-2.0", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", diff --git a/packages/backend-common/src/alpha.ts b/packages/backend-common/src/alpha.ts new file mode 100644 index 0000000000..e0a5b2ddc2 --- /dev/null +++ b/packages/backend-common/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 * from './context'; diff --git a/packages/backend-common/src/index.ts b/packages/backend-common/src/index.ts index 46639a1923..afb12115b2 100644 --- a/packages/backend-common/src/index.ts +++ b/packages/backend-common/src/index.ts @@ -24,7 +24,6 @@ export { legacyPlugin, makeLegacyPlugin } from './legacy'; export type { LegacyCreateRouter } from './legacy'; export * from './cache'; export { loadBackendConfig } from './config'; -export * from './context'; export * from './database'; export * from './discovery'; export * from './hot'; diff --git a/packages/backend-next/src/index.ts b/packages/backend-next/src/index.ts index f4979760cf..8e29244ebf 100644 --- a/packages/backend-next/src/index.ts +++ b/packages/backend-next/src/index.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -import { catalogPlugin } from '@backstage/plugin-catalog-backend'; -import { catalogModuleTemplateKind } from '@backstage/plugin-scaffolder-backend'; +import { catalogPlugin } from '@backstage/plugin-catalog-backend/alpha'; +import { catalogModuleTemplateKind } from '@backstage/plugin-scaffolder-backend/alpha'; import { createBackend } from '@backstage/backend-defaults'; -import { appPlugin } from '@backstage/plugin-app-backend'; +import { appPlugin } from '@backstage/plugin-app-backend/alpha'; import { todoPlugin } from '@backstage/plugin-todo-backend'; const backend = createBackend(); diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index f8af9e5bdc..30ea47c520 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -7,8 +7,7 @@ "publishConfig": { "access": "public", "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "types": "dist/index.d.ts" }, "backstage": { "role": "node-library" @@ -24,7 +23,7 @@ ], "license": "Apache-2.0", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", diff --git a/packages/backend-test-utils/package.json b/packages/backend-test-utils/package.json index a6f02257d8..7bcb680dfe 100644 --- a/packages/backend-test-utils/package.json +++ b/packages/backend-test-utils/package.json @@ -5,10 +5,18 @@ "main": "src/index.ts", "types": "src/index.ts", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "node-library" @@ -25,7 +33,7 @@ ], "license": "Apache-2.0", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -55,7 +63,6 @@ "supertest": "^6.1.3" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/packages/catalog-model/alpha-api-report.md b/packages/catalog-model/alpha-api-report.md new file mode 100644 index 0000000000..5b962a7403 --- /dev/null +++ b/packages/catalog-model/alpha-api-report.md @@ -0,0 +1,31 @@ +## API Report File for "@backstage/catalog-model" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { Entity } from '@backstage/catalog-model'; +import { SerializedError } from '@backstage/errors'; + +// @alpha +export interface AlphaEntity extends Entity { + status?: EntityStatus; +} + +// @alpha +export type EntityStatus = { + items?: EntityStatusItem[]; +}; + +// @alpha +export type EntityStatusItem = { + type: string; + level: EntityStatusLevel; + message: string; + error?: SerializedError; +}; + +// @alpha +export type EntityStatusLevel = 'info' | 'warning' | 'error'; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/catalog-model/api-report.md b/packages/catalog-model/api-report.md index 15eec90f09..b8eb20c590 100644 --- a/packages/catalog-model/api-report.md +++ b/packages/catalog-model/api-report.md @@ -4,12 +4,6 @@ ```ts import { JsonObject } from '@backstage/types'; -import { SerializedError } from '@backstage/errors'; - -// @alpha -export interface AlphaEntity extends Entity { - status?: EntityStatus; -} // @public export const ANNOTATION_EDIT_URL = 'backstage.io/edit-url'; @@ -209,22 +203,6 @@ export function entitySchemaValidator( schema?: unknown, ): (data: unknown) => T; -// @alpha -export type EntityStatus = { - items?: EntityStatusItem[]; -}; - -// @alpha -export type EntityStatusItem = { - type: string; - level: EntityStatusLevel; - message: string; - error?: SerializedError; -}; - -// @alpha -export type EntityStatusLevel = 'info' | 'warning' | 'error'; - // @public export class FieldFormatEntityPolicy implements EntityPolicy { constructor(validators?: Validators); diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 00f9543f52..b391ad79e4 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -6,11 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "common-library" @@ -25,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -48,7 +59,6 @@ "yaml": "^2.0.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/packages/catalog-model/src/alpha.ts b/packages/catalog-model/src/alpha.ts new file mode 100644 index 0000000000..1d29c97464 --- /dev/null +++ b/packages/catalog-model/src/alpha.ts @@ -0,0 +1,22 @@ +/* + * 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 type { + EntityStatus, + EntityStatusItem, + EntityStatusLevel, +} from './entity/EntityStatus'; +export type { AlphaEntity } from './entity/AlphaEntity'; diff --git a/packages/catalog-model/src/entity/AlphaEntity.ts b/packages/catalog-model/src/entity/AlphaEntity.ts new file mode 100644 index 0000000000..6f5c9d4fa7 --- /dev/null +++ b/packages/catalog-model/src/entity/AlphaEntity.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// TODO(Rugvip): Figure out best way to allow this import +// eslint-disable-next-line import/no-extraneous-dependencies +import { Entity } from '@backstage/catalog-model'; +import { EntityStatus } from './EntityStatus'; + +/** + * A version of the `Entity` type that contains unstable alpha fields. + * + * @remarks + * + * Available via the `@backstage/catalog-model/alpha` import. + * + * @alpha + */ +export interface AlphaEntity extends Entity { + /** + * The current status of the entity, as claimed by various sources. + * + * The keys are implementation defined and the values can be any JSON object + * with semantics that match that implementation. + */ + status?: EntityStatus; +} diff --git a/packages/catalog-model/src/entity/Entity.ts b/packages/catalog-model/src/entity/Entity.ts index 80c9adaffb..8d36fe0134 100644 --- a/packages/catalog-model/src/entity/Entity.ts +++ b/packages/catalog-model/src/entity/Entity.ts @@ -15,7 +15,6 @@ */ import { JsonObject } from '@backstage/types'; -import { EntityStatus } from './EntityStatus'; /** * The parts of the format that's common to all versions/kinds of entity. @@ -54,25 +53,6 @@ export type Entity = { relations?: EntityRelation[]; }; -/** - * A version of the {@link Entity} type that contains unstable alpha fields. - * - * @remarks - * - * Available via the `@backstage/catalog-model/alpha` import. - * - * @alpha - */ -export interface AlphaEntity extends Entity { - /** - * The current status of the entity, as claimed by various sources. - * - * The keys are implementation defined and the values can be any JSON object - * with semantics that match that implementation. - */ - status?: EntityStatus; -} - /** * Metadata fields common to all versions/kinds of entity. * diff --git a/packages/catalog-model/src/entity/index.ts b/packages/catalog-model/src/entity/index.ts index 87f414cc9c..269d56ec86 100644 --- a/packages/catalog-model/src/entity/index.ts +++ b/packages/catalog-model/src/entity/index.ts @@ -16,19 +16,8 @@ export * from './conditions'; export * from './constants'; -export type { - AlphaEntity, - Entity, - EntityLink, - EntityMeta, - EntityRelation, -} from './Entity'; +export type { Entity, EntityLink, EntityMeta, EntityRelation } from './Entity'; export type { EntityEnvelope } from './EntityEnvelope'; -export type { - EntityStatus, - EntityStatusItem, - EntityStatusLevel, -} from './EntityStatus'; export * from './policies'; export { getCompoundEntityRef, diff --git a/packages/cli/cli-report.md b/packages/cli/cli-report.md index fa9a2aca8d..bad849d283 100644 --- a/packages/cli/cli-report.md +++ b/packages/cli/cli-report.md @@ -127,11 +127,21 @@ Options: Commands: package-roles package-scripts + package-exports package-lint-configs react-router-deps help [command] ``` +### `backstage-cli migrate package-exports` + +``` +Usage: backstage-cli migrate package-exports [options] + +Options: + -h, --help +``` + ### `backstage-cli migrate package-lint-configs` ``` diff --git a/packages/cli/src/commands/build/buildBackend.ts b/packages/cli/src/commands/build/buildBackend.ts index d7c4f72dbe..7e61f9ae85 100644 --- a/packages/cli/src/commands/build/buildBackend.ts +++ b/packages/cli/src/commands/build/buildBackend.ts @@ -37,6 +37,7 @@ export async function buildBackend(options: BuildBackendOptions) { // We build the target package without generating type declarations. await buildPackage({ targetDir: options.targetDir, + packageJson: pkg, outputs: new Set([Output.cjs]), }); diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 628e46df85..ddec5c6a4a 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -116,7 +116,7 @@ export function registerScriptCommand(program: Command) { ) .option( '--experimental-type-build', - 'Enable experimental type build. Does not apply to app or backend packages.', + 'Enable experimental type build. Does not apply to app or backend packages. [DEPRECATED]', ) .option( '--skip-build-dependencies', @@ -191,6 +191,13 @@ export function registerMigrateCommand(program: Command) { lazy(() => import('./migrate/packageScripts').then(m => m.command)), ); + command + .command('package-exports') + .description('Synchronize package subpath export definitions') + .action( + lazy(() => import('./migrate/packageExports').then(m => m.command)), + ); + command .command('package-lint-configs') .description( diff --git a/packages/cli/src/commands/migrate/packageExports.ts b/packages/cli/src/commands/migrate/packageExports.ts new file mode 100644 index 0000000000..ff01f939f9 --- /dev/null +++ b/packages/cli/src/commands/migrate/packageExports.ts @@ -0,0 +1,121 @@ +/* + * 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 fs from 'fs-extra'; +import { resolve as resolvePath } from 'path'; +import { ExtendedPackageJSON, PackageGraph } from '../../lib/monorepo'; + +function trimRelative(path: string): string { + if (path.startsWith('./')) { + return path.slice(2); + } + return path; +} + +export async function command() { + const packages = await PackageGraph.listTargetPackages(); + + await Promise.all( + packages.map(async ({ dir, packageJson }) => { + let changed = false; + let newPackageJson = packageJson; + + let { exports: exp } = newPackageJson; + if (!exp) { + return; + } + if (Array.isArray(exp)) { + throw new Error('Unexpected array in package.json exports field'); + } + + // If exports is a string we rewrite it to an object to add package.json + if (typeof exp === 'string') { + changed = true; + exp = { '.': exp }; + newPackageJson.exports = exp; + } else if (typeof exp !== 'object') { + return; + } + + if (!exp['./package.json']) { + changed = true; + exp['./package.json'] = './package.json'; + } + + const existingTypesVersions = JSON.stringify(packageJson.typesVersions); + + const typeEntries: Record = {}; + for (const [path, value] of Object.entries(exp)) { + // Main entry point does not need to be listed + if (path === '.') { + continue; + } + const newPath = trimRelative(path); + + if (typeof value === 'string') { + typeEntries[newPath] = [trimRelative(value)]; + } else if ( + value && + typeof value === 'object' && + !Array.isArray(value) + ) { + if (typeof value.types === 'string') { + typeEntries[newPath] = [trimRelative(value.types)]; + } else if (typeof value.default === 'string') { + typeEntries[newPath] = [trimRelative(value.default)]; + } + } + } + + const typesVersions = { '*': typeEntries }; + if (existingTypesVersions !== JSON.stringify(typesVersions)) { + console.log(`Synchronizing exports in ${packageJson.name}`); + const newPkgEntries = Object.entries(newPackageJson).filter( + ([name]) => name !== 'typesVersions', + ); + newPkgEntries.splice( + newPkgEntries.findIndex(([name]) => name === 'exports') + 1, + 0, + ['typesVersions', typesVersions], + ); + + newPackageJson = Object.fromEntries( + newPkgEntries, + ) as ExtendedPackageJSON; + changed = true; + } + + // Remove the legacy fields from publishConfig, which are no longer needed + const publishConfig = newPackageJson.publishConfig as + | Record + | undefined; + if (publishConfig) { + for (const field of ['main', 'module', 'browser', 'types']) { + if (publishConfig[field]) { + delete publishConfig[field]; + changed = true; + } + } + } + + if (changed) { + await fs.writeJson(resolvePath(dir, 'package.json'), newPackageJson, { + spaces: 2, + }); + } + }), + ); +} diff --git a/packages/cli/src/commands/pack.ts b/packages/cli/src/commands/pack.ts index 6c88ac055f..9c101e97fe 100644 --- a/packages/cli/src/commands/pack.ts +++ b/packages/cli/src/commands/pack.ts @@ -14,77 +14,16 @@ * limitations under the License. */ -import fs from 'fs-extra'; +import { + productionPack, + revertProductionPack, +} from '../lib/packager/productionPack'; import { paths } from '../lib/paths'; -import { join as joinPath } from 'path'; - -const SKIPPED_KEYS = ['access', 'registry', 'tag', 'alphaTypes', 'betaTypes']; - -const PKG_PATH = 'package.json'; -const PKG_BACKUP_PATH = 'package.json-prepack'; - -function resolveEntrypoint(pkg: any, name: string) { - const targetEntry = pkg.publishConfig[name] || pkg[name]; - return targetEntry && joinPath('..', targetEntry); -} - -// Writes e.g. alpha/package.json -async function writeReleaseStageEntrypoint(pkg: any, stage: 'alpha' | 'beta') { - await fs.ensureDir(paths.resolveTarget(stage)); - await fs.writeJson( - paths.resolveTarget(stage, PKG_PATH), - { - name: pkg.name, - version: pkg.version, - main: resolveEntrypoint(pkg, 'main'), - module: resolveEntrypoint(pkg, 'module'), - browser: resolveEntrypoint(pkg, 'browser'), - types: joinPath('..', pkg.publishConfig[`${stage}Types`]), - }, - { encoding: 'utf8', spaces: 2 }, - ); -} export const pre = async () => { - const pkgPath = paths.resolveTarget(PKG_PATH); - - const pkgContent = await fs.readFile(pkgPath, 'utf8'); - const pkg = JSON.parse(pkgContent); - await fs.writeFile(PKG_BACKUP_PATH, pkgContent); - - const publishConfig = pkg.publishConfig ?? {}; - for (const key of Object.keys(publishConfig)) { - if (!SKIPPED_KEYS.includes(key)) { - pkg[key] = publishConfig[key]; - } - } - await fs.writeJson(pkgPath, pkg, { encoding: 'utf8', spaces: 2 }); - - if (publishConfig.alphaTypes) { - await writeReleaseStageEntrypoint(pkg, 'alpha'); - } - if (publishConfig.betaTypes) { - await writeReleaseStageEntrypoint(pkg, 'beta'); - } + await productionPack({ packageDir: paths.targetDir }); }; export const post = async () => { - // postpack isn't called by yarn right now, so it needs to be called manually - try { - await fs.move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true }); - - // Check if we're shipping types for other release stages, clean up in that case - const pkg = await fs.readJson(PKG_PATH); - if (pkg.publishConfig?.alphaTypes) { - await fs.remove(paths.resolveTarget('alpha')); - } - if (pkg.publishConfig?.betaTypes) { - await fs.remove(paths.resolveTarget('beta')); - } - } catch (error) { - console.warn( - `Failed to restore package.json during postpack, ${error}. ` + - 'Your package will be fine but you may have ended up with some garbage in the repo.', - ); - } + await revertProductionPack(paths.targetDir); }; diff --git a/packages/cli/src/commands/repo/build.ts b/packages/cli/src/commands/repo/build.ts index a6bf87da82..d5602a4008 100644 --- a/packages/cli/src/commands/repo/build.ts +++ b/packages/cli/src/commands/repo/build.ts @@ -130,6 +130,7 @@ export async function command(opts: OptionValues, cmd: Command): Promise { return { targetDir: pkg.dir, + packageJson: pkg.packageJson, outputs, logPrefix: `${chalk.cyan(relativePath(paths.targetRoot, pkg.dir))}: `, minify: buildOptions.minify, diff --git a/packages/cli/src/lib/builder/config.test.ts b/packages/cli/src/lib/builder/config.test.ts index a2e99da73b..733c35fb55 100644 --- a/packages/cli/src/lib/builder/config.test.ts +++ b/packages/cli/src/lib/builder/config.test.ts @@ -24,6 +24,11 @@ describe('makeRollupConfigs', () => { const [config] = await makeRollupConfigs({ outputs: new Set([Output.cjs]), + packageJson: { + name: 'test', + version: '0.0.0', + main: './src/index.ts', + }, }); const external = config.external as Exclude< ExternalOption, diff --git a/packages/cli/src/lib/builder/config.ts b/packages/cli/src/lib/builder/config.ts index 1cfaf15bfc..ecd755d05b 100644 --- a/packages/cli/src/lib/builder/config.ts +++ b/packages/cli/src/lib/builder/config.ts @@ -31,6 +31,10 @@ import { forwardFileImports } from './plugins'; import { BuildOptions, Output } from './types'; import { paths } from '../paths'; import { svgrTemplate } from '../svgrTemplate'; +import { ExtendedPackageJSON } from '../monorepo'; +import { readEntryPoints } from '../monorepo/entryPoints'; + +const SCRIPT_EXTS = ['.js', '.jsx', '.ts', '.tsx']; function isFileImport(source: string) { if (source.startsWith('.')) { @@ -50,6 +54,13 @@ export async function makeRollupConfigs( ): Promise { const configs = new Array(); const targetDir = options.targetDir ?? paths.targetDir; + + let targetPkg = options.packageJson; + if (!targetPkg) { + const packagePath = resolvePath(targetDir, 'package.json'); + targetPkg = (await fs.readJson(packagePath)) as ExtendedPackageJSON; + } + const onwarn = ({ code, message }: RollupWarning) => { if (code === 'EMPTY_BUNDLE') { return; // We don't care about this one @@ -62,111 +73,118 @@ export async function makeRollupConfigs( }; const distDir = resolvePath(targetDir, 'dist'); + const entryPoints = readEntryPoints(targetPkg); - if (options.outputs.has(Output.cjs) || options.outputs.has(Output.esm)) { - const output = new Array(); - const mainFields = ['module', 'main']; - - if (options.outputs.has(Output.cjs)) { - output.push({ - dir: distDir, - entryFileNames: 'index.cjs.js', - chunkFileNames: 'cjs/[name]-[hash].cjs.js', - format: 'commonjs', - sourcemap: true, - }); - } - if (options.outputs.has(Output.esm)) { - output.push({ - dir: distDir, - entryFileNames: 'index.esm.js', - chunkFileNames: 'esm/[name]-[hash].esm.js', - format: 'module', - sourcemap: true, - }); - // Assume we're building for the browser if ESM output is included - mainFields.unshift('browser'); + for (const { path, name, ext } of entryPoints) { + if (!SCRIPT_EXTS.includes(ext)) { + continue; } - configs.push({ - input: resolvePath(targetDir, 'src/index.ts'), - output, - onwarn, - preserveEntrySignatures: 'strict', - // All module imports are always marked as external - external: (source, importer, isResolved) => - Boolean(importer && !isResolved && !isFileImport(source)), - plugins: [ - resolve({ mainFields }), - commonjs({ - include: /node_modules/, - exclude: [/\/[^/]+\.(?:stories|test)\.[^/]+$/], - }), - postcss(), - forwardFileImports({ - exclude: /\.icon\.svg$/, - include: [ - /\.svg$/, - /\.png$/, - /\.gif$/, - /\.jpg$/, - /\.jpeg$/, - /\.eot$/, - /\.woff$/, - /\.woff2$/, - /\.ttf$/, - ], - }), - json(), - yaml(), - svgr({ - include: /\.icon\.svg$/, - template: svgrTemplate, - }), - esbuild({ - target: 'es2019', - minify: options.minify, - }), - ], - }); - } + if (options.outputs.has(Output.cjs) || options.outputs.has(Output.esm)) { + const output = new Array(); + const mainFields = ['module', 'main']; - if (options.outputs.has(Output.types) && !options.useApiExtractor) { - const typesInput = paths.resolveTargetRoot( - 'dist-types', - relativePath(paths.targetRoot, targetDir), - 'src/index.d.ts', - ); + if (options.outputs.has(Output.cjs)) { + output.push({ + dir: distDir, + entryFileNames: `${name}.cjs.js`, + chunkFileNames: `cjs/${name}/[name]-[hash].cjs.js`, + format: 'commonjs', + sourcemap: true, + }); + } + if (options.outputs.has(Output.esm)) { + output.push({ + dir: distDir, + entryFileNames: `${name}.esm.js`, + chunkFileNames: `esm/${name}/[name]-[hash].esm.js`, + format: 'module', + sourcemap: true, + }); + // Assume we're building for the browser if ESM output is included + mainFields.unshift('browser'); + } - const declarationsExist = await fs.pathExists(typesInput); - if (!declarationsExist) { - const path = relativePath(targetDir, typesInput); - throw new Error( - `No declaration files found at ${path}, be sure to run ${chalk.bgRed.white( - 'yarn tsc', - )} to generate .d.ts files before packaging`, + configs.push({ + input: resolvePath(targetDir, path), + output, + onwarn, + preserveEntrySignatures: 'strict', + // All module imports are always marked as external + external: (source, importer, isResolved) => + Boolean(importer && !isResolved && !isFileImport(source)), + plugins: [ + resolve({ mainFields }), + commonjs({ + include: /node_modules/, + exclude: [/\/[^/]+\.(?:stories|test)\.[^/]+$/], + }), + postcss(), + forwardFileImports({ + exclude: /\.icon\.svg$/, + include: [ + /\.svg$/, + /\.png$/, + /\.gif$/, + /\.jpg$/, + /\.jpeg$/, + /\.eot$/, + /\.woff$/, + /\.woff2$/, + /\.ttf$/, + ], + }), + json(), + yaml(), + svgr({ + include: /\.icon\.svg$/, + template: svgrTemplate, + }), + esbuild({ + target: 'es2019', + minify: options.minify, + }), + ], + }); + } + + if (options.outputs.has(Output.types) && !options.useApiExtractor) { + const typesInput = paths.resolveTargetRoot( + 'dist-types', + relativePath(paths.targetRoot, targetDir), + path.replace(/\.ts$/, '.d.ts'), ); - } - configs.push({ - input: typesInput, - output: { - file: resolvePath(distDir, 'index.d.ts'), - format: 'es', - }, - external: [ - /\.css$/, - /\.scss$/, - /\.sass$/, - /\.svg$/, - /\.eot$/, - /\.woff$/, - /\.woff2$/, - /\.ttf$/, - ], - onwarn, - plugins: [dts()], - }); + const declarationsExist = await fs.pathExists(typesInput); + if (!declarationsExist) { + const declarationPath = relativePath(targetDir, typesInput); + throw new Error( + `No declaration files found at ${declarationPath}, be sure to run ${chalk.bgRed.white( + 'yarn tsc', + )} to generate .d.ts files before packaging`, + ); + } + + configs.push({ + input: typesInput, + output: { + file: resolvePath(distDir, `${name}.d.ts`), + format: 'es', + }, + external: [ + /\.css$/, + /\.scss$/, + /\.sass$/, + /\.svg$/, + /\.eot$/, + /\.woff$/, + /\.woff2$/, + /\.ttf$/, + ], + onwarn, + plugins: [dts()], + }); + } } return configs; diff --git a/packages/cli/src/lib/builder/types.ts b/packages/cli/src/lib/builder/types.ts index f43d84cd92..de7e9b10eb 100644 --- a/packages/cli/src/lib/builder/types.ts +++ b/packages/cli/src/lib/builder/types.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +import { ExtendedPackageJSON } from '../monorepo'; + export enum Output { esm, cjs, @@ -23,6 +25,7 @@ export enum Output { export type BuildOptions = { logPrefix?: string; targetDir?: string; + packageJson?: ExtendedPackageJSON; outputs: Set; minify?: boolean; useApiExtractor?: boolean; diff --git a/packages/cli/src/lib/monorepo/PackageGraph.ts b/packages/cli/src/lib/monorepo/PackageGraph.ts index a1fc95e669..bb203c01a5 100644 --- a/packages/cli/src/lib/monorepo/PackageGraph.ts +++ b/packages/cli/src/lib/monorepo/PackageGraph.ts @@ -20,10 +20,15 @@ import { paths } from '../paths'; import { PackageRole } from '../role'; import { listChangedFiles, readFileAtRef } from '../git'; import { Lockfile } from '../versioning'; +import { JsonValue } from '@backstage/types'; type PackageJSON = Package['packageJson']; export interface ExtendedPackageJSON extends PackageJSON { + main?: string; + module?: string; + types?: string; + scripts?: { [key: string]: string; }; @@ -34,6 +39,19 @@ export interface ExtendedPackageJSON extends PackageJSON { backstage?: { role?: PackageRole; }; + + exports?: JsonValue; + typesVersions?: Record>; + + files?: string[]; + + publishConfig?: { + access?: 'public' | 'restricted'; + directory?: string; + registry?: string; + alphaTypes?: string; + betaTypes?: string; + }; } export type ExtendedPackage = { diff --git a/packages/cli/src/lib/monorepo/entryPoints.ts b/packages/cli/src/lib/monorepo/entryPoints.ts new file mode 100644 index 0000000000..1e1fd7ed27 --- /dev/null +++ b/packages/cli/src/lib/monorepo/entryPoints.ts @@ -0,0 +1,77 @@ +/* + * 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 { extname } from 'path'; +import { ExtendedPackageJSON } from './PackageGraph'; + +export interface EntryPoint { + mount: string; + path: string; + name: string; + ext: string; +} + +// Unless explicitly specified in exports, the index entrypoint is always +// assumed to be at src/index.ts for backwards compatibility. +const defaultIndex = { + mount: '.', + path: 'src/index.ts', + name: 'index', + ext: '.ts', +}; + +function parseEntryPoint(mount: string, path: string): EntryPoint { + let name = mount; + if (name === '.') { + name = 'index'; + } else if (name.startsWith('./')) { + name = name.slice(2); + } + if (name.includes('/')) { + throw new Error(`Mount point '${mount}' may not contain multiple slashes`); + } + + return { mount, path, name, ext: extname(path) }; +} + +export function readEntryPoints(pkg: ExtendedPackageJSON): Array { + const exp = pkg.exports; + if (typeof exp === 'string') { + return [defaultIndex]; + } else if (exp && typeof exp === 'object' && !Array.isArray(exp)) { + const entryPoints = new Array<{ + mount: string; + path: string; + name: string; + ext: string; + }>(); + + for (const mount of Object.keys(exp)) { + const path = exp[mount]; + if (typeof path !== 'string') { + throw new Error( + `Exports field value must be a string, got '${JSON.stringify(path)}'`, + ); + } + + entryPoints.push(parseEntryPoint(mount, path)); + } + + return entryPoints; + } + + return [defaultIndex]; +} diff --git a/packages/cli/src/lib/packager/copyPackageDist.ts b/packages/cli/src/lib/packager/copyPackageDist.ts deleted file mode 100644 index b704148542..0000000000 --- a/packages/cli/src/lib/packager/copyPackageDist.ts +++ /dev/null @@ -1,93 +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 fs from 'fs-extra'; -import npmPackList from 'npm-packlist'; -import { join as joinPath, resolve as resolvePath } from 'path'; - -const SKIPPED_KEYS = ['access', 'registry', 'tag', 'alphaTypes', 'betaTypes']; - -function resolveEntrypoint(pkg: any, name: string) { - const targetEntry = pkg.publishConfig[name] || pkg[name]; - return targetEntry && joinPath('..', targetEntry); -} - -// Writes e.g. alpha/package.json -async function writeReleaseStageEntrypoint( - pkg: any, - stage: 'alpha' | 'beta', - targetDir: string, -) { - await fs.ensureDir(resolvePath(targetDir, stage)); - await fs.writeJson( - resolvePath(targetDir, stage, 'package.json'), - { - name: pkg.name, - version: pkg.version, - main: resolveEntrypoint(pkg, 'main'), - module: resolveEntrypoint(pkg, 'module'), - browser: resolveEntrypoint(pkg, 'browser'), - types: joinPath('..', pkg.publishConfig[`${stage}Types`]), - }, - { encoding: 'utf8', spaces: 2 }, - ); -} - -export async function copyPackageDist(packageDir: string, targetDir: string) { - const pkgPath = resolvePath(packageDir, 'package.json'); - const pkgContent = await fs.readFile(pkgPath, 'utf8'); - const pkg = JSON.parse(pkgContent); - - const publishConfig = pkg.publishConfig ?? {}; - for (const key of Object.keys(publishConfig)) { - if (!SKIPPED_KEYS.includes(key)) { - pkg[key] = publishConfig[key]; - } - } - - // We remove the dependencies from package.json of packages that are marked - // as bundled, so that yarn doesn't try to install them. - if (pkg.bundled) { - delete pkg.dependencies; - delete pkg.devDependencies; - delete pkg.peerDependencies; - delete pkg.optionalDependencies; - } - - // Lists all dist files, respecting .npmignore, files field in package.json, etc. - const filePaths = await npmPackList({ - path: packageDir, - // This makes sure we use the update package.json when listing files - packageJsonCache: new Map([[resolvePath(packageDir, 'package.json'), pkg]]), - }); - - await fs.ensureDir(targetDir); - for (const filePath of filePaths.sort()) { - const target = resolvePath(targetDir, filePath); - if (filePath === 'package.json') { - await fs.writeJson(target, pkg, { encoding: 'utf8', spaces: 2 }); - } else { - await fs.copy(resolvePath(packageDir, filePath), target); - } - } - - if (publishConfig.alphaTypes) { - await writeReleaseStageEntrypoint(pkg, 'alpha', targetDir); - } - if (publishConfig.betaTypes) { - await writeReleaseStageEntrypoint(pkg, 'beta', targetDir); - } -} diff --git a/packages/cli/src/lib/packager/createDistWorkspace.ts b/packages/cli/src/lib/packager/createDistWorkspace.ts index 5451a873f7..2d2967fc44 100644 --- a/packages/cli/src/lib/packager/createDistWorkspace.ts +++ b/packages/cli/src/lib/packager/createDistWorkspace.ts @@ -37,7 +37,7 @@ import { getOutputsForRole, Output, } from '../builder'; -import { copyPackageDist } from './copyPackageDist'; +import { productionPack } from './productionPack'; import { getRoleInfo } from '../role'; import { runParallelWorkers } from '../parallel'; @@ -178,6 +178,7 @@ export async function createDistWorkspace( if (outputs.size > 0) { standardBuilds.push({ targetDir: pkg.dir, + packageJson: pkg.packageJson, outputs: outputs, logPrefix: `${chalk.cyan(relativePath(paths.targetRoot, pkg.dir))}: `, // No need to detect these for the backend builds, we assume no minification or types @@ -257,7 +258,10 @@ async function moveToDistWorkspace( const outputDir = relativePath(paths.targetRoot, target.dir); const absoluteOutputPath = resolvePath(workspaceDir, outputDir); - await copyPackageDist(target.dir, absoluteOutputPath); + await productionPack({ + packageDir: target.dir, + targetDir: absoluteOutputPath, + }); }), ); diff --git a/packages/cli/src/lib/packager/productionPack.ts b/packages/cli/src/lib/packager/productionPack.ts new file mode 100644 index 0000000000..b91112216a --- /dev/null +++ b/packages/cli/src/lib/packager/productionPack.ts @@ -0,0 +1,259 @@ +/* + * 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 fs from 'fs-extra'; +import npmPackList from 'npm-packlist'; +import { join as joinPath, resolve as resolvePath } from 'path'; +import { ExtendedPackageJSON } from '../monorepo'; +import { readEntryPoints } from '../monorepo/entryPoints'; + +const PKG_PATH = 'package.json'; +const PKG_BACKUP_PATH = 'package.json-prepack'; + +const SKIPPED_KEYS = ['access', 'registry', 'tag', 'alphaTypes', 'betaTypes']; +const SCRIPT_EXTS = ['.js', '.jsx', '.ts', '.tsx']; + +interface ProductionPackOptions { + packageDir: string; + targetDir?: string; +} + +export async function productionPack(options: ProductionPackOptions) { + const { packageDir, targetDir } = options; + const pkgPath = resolvePath(packageDir, PKG_PATH); + const pkgContent = await fs.readFile(pkgPath, 'utf8'); + const pkg = JSON.parse(pkgContent) as ExtendedPackageJSON; + + // If we're making the update in-line, back up the package.json + if (!targetDir) { + await fs.writeFile(PKG_BACKUP_PATH, pkgContent); + } + + const hasStageEntry = + !!pkg.publishConfig?.alphaTypes || !!pkg.publishConfig?.betaTypes; + if (pkg.exports && hasStageEntry) { + throw new Error( + 'Combining both exports and alpha/beta types is not supported', + ); + } + + // This mutates pkg to fill in index exports, so call it before applying publishConfig + const writeCompatibilityEntryPoints = await prepareExportsEntryPoints( + pkg, + packageDir, + ); + + // TODO(Rugvip): Once exports are rolled out more broadly we should deprecate and remove this behavior + const publishConfig = pkg.publishConfig ?? {}; + for (const key of Object.keys(publishConfig)) { + if (!SKIPPED_KEYS.includes(key)) { + (pkg as any)[key] = publishConfig[key as keyof typeof publishConfig]; + } + } + + // For published packages we rely on compatibility entry points rather than this + delete pkg.typesVersions; + + // We remove the dependencies from package.json of packages that are marked + // as bundled, so that yarn doesn't try to install them. + if (pkg.bundled) { + delete pkg.dependencies; + delete pkg.devDependencies; + delete pkg.peerDependencies; + delete pkg.optionalDependencies; + } + + if (targetDir) { + // Lists all dist files, respecting .npmignore, files field in package.json, etc. + const filePaths = await npmPackList({ + path: packageDir, + // This makes sure we use the updated package.json when listing files + packageJsonCache: new Map([ + [resolvePath(packageDir, PKG_PATH), pkg], + ]) as any, // Seems like this parameter type is wrong, + }); + + await fs.ensureDir(targetDir); + for (const filePath of filePaths.sort()) { + const target = resolvePath(targetDir, filePath); + if (filePath === PKG_PATH) { + await fs.writeJson(target, pkg, { encoding: 'utf8', spaces: 2 }); + } else { + await fs.copy(resolvePath(packageDir, filePath), target); + } + } + } else { + await fs.writeJson(pkgPath, pkg, { encoding: 'utf8', spaces: 2 }); + } + + if (publishConfig.alphaTypes) { + await writeReleaseStageEntrypoint(pkg, 'alpha', targetDir ?? packageDir); + } + if (publishConfig.betaTypes) { + await writeReleaseStageEntrypoint(pkg, 'beta', targetDir ?? packageDir); + } + if (writeCompatibilityEntryPoints) { + await writeCompatibilityEntryPoints(targetDir ?? packageDir); + } +} + +// Reverts the changes made by productionPack when called without a targetDir. +export async function revertProductionPack(packageDir: string) { + // postpack isn't called by yarn right now, so it needs to be called manually + try { + await fs.move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true }); + + // Check if we're shipping types for other release stages, clean up in that case + const pkg = await fs.readJson(PKG_PATH); + if (pkg.publishConfig?.alphaTypes) { + await fs.remove(resolvePath(packageDir, 'alpha')); + } + if (pkg.publishConfig?.betaTypes) { + await fs.remove(resolvePath(packageDir, 'beta')); + } + + // Remove any extra entrypoint backwards compatibility directories + const entryPoints = readEntryPoints(pkg); + for (const entryPoint of entryPoints) { + if (entryPoint.mount !== '.' && SCRIPT_EXTS.includes(entryPoint.ext)) { + await fs.remove(resolvePath(packageDir, entryPoint.name)); + } + } + } catch (error) { + console.warn( + `Failed to restore package.json, ${error}. ` + + 'Your package will be fine but you may have ended up with some garbage in the repo.', + ); + } +} + +function resolveEntrypoint(pkg: any, name: string) { + const targetEntry = pkg.publishConfig[name] || pkg[name]; + return targetEntry && joinPath('..', targetEntry); +} + +// Writes e.g. alpha/package.json +async function writeReleaseStageEntrypoint( + pkg: ExtendedPackageJSON, + stage: 'alpha' | 'beta', + targetDir: string, +) { + await fs.ensureDir(resolvePath(targetDir, stage)); + await fs.writeJson( + resolvePath(targetDir, stage, PKG_PATH), + { + name: pkg.name, + version: pkg.version, + main: resolveEntrypoint(pkg, 'main'), + module: resolveEntrypoint(pkg, 'module'), + browser: resolveEntrypoint(pkg, 'browser'), + types: joinPath('..', pkg.publishConfig![`${stage}Types`]!), + }, + { encoding: 'utf8', spaces: 2 }, + ); +} + +const EXPORT_MAP = { + import: '.esm.js', + require: '.cjs.js', + types: '.d.ts', +}; + +/** + * Rewrites the exports field in package.json to point to dist files, as + * well as returning a function that creates backwards compatibility + * entry points for importers that don't support exports. + */ +async function prepareExportsEntryPoints( + pkg: ExtendedPackageJSON, + packageDir: string, +) { + const distPath = resolvePath(packageDir, 'dist'); + if (!(await fs.pathExists(distPath))) { + return undefined; + } + const distFiles = await fs.readdir(distPath); + const outputExports = {} as Record>; + + const compatibilityWriters = new Array< + (targetDir: string) => Promise + >(); + + const entryPoints = readEntryPoints(pkg); + for (const entryPoint of entryPoints) { + if (!SCRIPT_EXTS.includes(entryPoint.ext)) { + continue; + } + const exp = {} as Record; + for (const [key, ext] of Object.entries(EXPORT_MAP)) { + const name = `${entryPoint.name}${ext}`; + if (distFiles.includes(name)) { + exp[key] = `./${joinPath(`dist`, name)}`; + } + } + exp.default = exp.require ?? exp.import; + + // This creates a directory with a lone package.json for backwards compatibility + if (entryPoint.mount === '.') { + if (exp.default) { + pkg.main = exp.default; + } + if (exp.import) { + pkg.module = exp.import; + } + if (exp.types) { + pkg.types = exp.types; + } + } else { + // This is deferred until after we have created the target directory + compatibilityWriters.push(async targetDir => { + const entryPointDir = resolvePath(targetDir, entryPoint.name); + await fs.ensureDir(entryPointDir); + await fs.writeJson( + resolvePath(entryPointDir, PKG_PATH), + { + name: pkg.name, + version: pkg.version, + ...(exp.default ? { main: joinPath('..', exp.default) } : {}), + ...(exp.import ? { module: joinPath('..', exp.import) } : {}), + ...(exp.types ? { types: joinPath('..', exp.types) } : {}), + }, + { encoding: 'utf8', spaces: 2 }, + ); + }); + if (Array.isArray(pkg.files) && !pkg.files.includes(entryPoint.name)) { + pkg.files.push(entryPoint.name); + } + } + + if (Object.keys(exp).length > 0) { + outputExports[entryPoint.mount] = exp; + } + } + + if (pkg.exports) { + pkg.exports = outputExports; + // We treat package.json as a fixed export that is always available in the published package + pkg.exports['./package.json'] = './package.json'; + } + + if (compatibilityWriters.length > 0) { + return async (targetDir: string) => { + await Promise.all(compatibilityWriters.map(writer => writer(targetDir))); + }; + } + return undefined; +} diff --git a/packages/core-plugin-api/alpha-api-report.md b/packages/core-plugin-api/alpha-api-report.md new file mode 100644 index 0000000000..379e186df8 --- /dev/null +++ b/packages/core-plugin-api/alpha-api-report.md @@ -0,0 +1,26 @@ +## API Report File for "@backstage/core-plugin-api" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { ReactNode } from 'react'; + +// @alpha +export interface PluginOptionsProviderProps { + // (undocumented) + children: ReactNode; + // (undocumented) + plugin?: BackstagePlugin; +} + +// @alpha +export const PluginProvider: (props: PluginOptionsProviderProps) => JSX.Element; + +// @alpha +export function usePluginOptions< + TPluginOptions extends {} = {}, +>(): TPluginOptions; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 91f05921bf..4887f0b7f2 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -649,17 +649,6 @@ export type PluginFeatureFlagConfig = { name: string; }; -// @alpha -export interface PluginOptionsProviderProps { - // (undocumented) - children: ReactNode; - // (undocumented) - plugin?: BackstagePlugin; -} - -// @alpha -export const PluginProvider: (props: PluginOptionsProviderProps) => JSX.Element; - // @public export type ProfileInfo = { email?: string; @@ -760,11 +749,6 @@ export function useElementFilter( dependencies?: any[], ): T; -// @alpha -export function usePluginOptions< - TPluginOptions extends {} = {}, ->(): TPluginOptions; - // @public export function useRouteRef( routeRef: ExternalRouteRef, diff --git a/packages/core-plugin-api/package.json b/packages/core-plugin-api/package.json index f1f023eedb..d34d13dbe1 100644 --- a/packages/core-plugin-api/package.json +++ b/packages/core-plugin-api/package.json @@ -3,10 +3,22 @@ "description": "Core API used by Backstage plugins", "version": "1.4.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "web-library" @@ -24,7 +36,7 @@ "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -60,7 +72,6 @@ "msw": "^0.49.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/packages/core-plugin-api/src/alpha.ts b/packages/core-plugin-api/src/alpha.ts new file mode 100644 index 0000000000..09983a48e9 --- /dev/null +++ b/packages/core-plugin-api/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 * from './plugin-options'; diff --git a/packages/core-plugin-api/src/index.ts b/packages/core-plugin-api/src/index.ts index e8edd38ff3..30fc35b62a 100644 --- a/packages/core-plugin-api/src/index.ts +++ b/packages/core-plugin-api/src/index.ts @@ -22,7 +22,6 @@ export * from './analytics'; export * from './apis'; -export * from './plugin-options'; export * from './app'; export * from './extensions'; export * from './icons'; diff --git a/packages/core-plugin-api/src/plugin-options/usePluginOptions.tsx b/packages/core-plugin-api/src/plugin-options/usePluginOptions.tsx index 4fdacc1ace..8b3f7c109c 100644 --- a/packages/core-plugin-api/src/plugin-options/usePluginOptions.tsx +++ b/packages/core-plugin-api/src/plugin-options/usePluginOptions.tsx @@ -19,7 +19,7 @@ import { createVersionedValueMap, useVersionedContext, } from '@backstage/version-bridge'; -import { BackstagePlugin } from '../plugin'; +import { BackstagePlugin } from '@backstage/core-plugin-api'; import React, { ReactNode } from 'react'; const contextKey: string = 'plugin-context'; diff --git a/packages/repo-tools/cli-report.md b/packages/repo-tools/cli-report.md index 3378d20ea7..0e1b2d2a4c 100644 --- a/packages/repo-tools/cli-report.md +++ b/packages/repo-tools/cli-report.md @@ -29,6 +29,7 @@ Options: -a, --allow-warnings --allow-all-warnings -o, --omit-messages + --validate-release-tags -h, --help ``` diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 5a5683dff9..0fc5cc3554 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -45,6 +45,7 @@ }, "devDependencies": { "@backstage/cli": "workspace:^", + "@backstage/types": "workspace:^", "@types/is-glob": "^4.0.2", "@types/mock-fs": "^4.13.0", "mock-fs": "^5.1.0" diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 39df70c21a..1fe7602617 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -62,6 +62,7 @@ import { IMarkdownEmitterContext } from '@microsoft/api-documenter/lib/markdown/ import { AstDeclaration } from '@microsoft/api-extractor/lib/analyzer/AstDeclaration'; import { paths as cliPaths } from '../../lib/paths'; import minimatch from 'minimatch'; +import { getPackageExportNames } from '../../lib/entryPoints'; const tmpDir = cliPaths.resolveTargetRoot( './node_modules/.cache/api-extractor', @@ -237,10 +238,9 @@ export async function createTemporaryTsConfig(includedPackageDirs: string[]) { return path; } -export async function countApiReportWarnings(projectFolder: string) { - const path = resolvePath(projectFolder, 'api-report.md'); +export async function countApiReportWarnings(reportPath: string) { try { - const content = await fs.readFile(path, 'utf8'); + const content = await fs.readFile(reportPath, 'utf8'); const lines = content.split('\n'); const lineWarnings = lines.filter(line => @@ -300,6 +300,32 @@ function logApiReportInstructions() { console.log(''); } +async function findPackageEntryPoints(packageDirs: string[]): Promise< + Array<{ + packageDir: string; + name: string; + usesExperimentalTypeBuild?: boolean; + }> +> { + return Promise.all( + packageDirs.map(async packageDir => { + const pkg = await fs.readJson( + cliPaths.resolveTargetRoot(packageDir, 'package.json'), + ); + + return ( + getPackageExportNames(pkg)?.map(name => ({ packageDir, name })) ?? { + packageDir, + name: 'index', + usesExperimentalTypeBuild: pkg.scripts?.build?.includes( + '--experimental-type-build', + ), + } + ); + }), + ).then(results => results.flat()); +} + interface ApiExtractionOptions { packageDirs: string[]; outputDir: string; @@ -307,6 +333,7 @@ interface ApiExtractionOptions { tsconfigFilePath: string; allowWarnings?: boolean | string[]; omitMessages?: string[]; + validateReleaseTags?: boolean; } export async function runApiExtraction({ @@ -316,12 +343,15 @@ export async function runApiExtraction({ tsconfigFilePath, allowWarnings = false, omitMessages = [], + validateReleaseTags = false, }: ApiExtractionOptions) { await fs.remove(outputDir); - const entryPoints = packageDirs.map(packageDir => { + const packageEntryPoints = await findPackageEntryPoints(packageDirs); + + const entryPoints = packageEntryPoints.map(({ packageDir, name }) => { return cliPaths.resolveTargetRoot( - `./dist-types/${packageDir}/src/index.d.ts`, + `./dist-types/${packageDir}/src/${name}.d.ts`, ); }); @@ -337,7 +367,11 @@ export async function runApiExtraction({ } const warnings = new Array(); - for (const packageDir of packageDirs) { + for (const { + packageDir, + name, + usesExperimentalTypeBuild, + } of packageEntryPoints) { console.log(`## Processing ${packageDir}`); const noBail = Array.isArray(allowWarnings) ? allowWarnings.some(aw => aw === packageDir || minimatch(packageDir, aw)) @@ -349,11 +383,15 @@ export async function runApiExtraction({ packageDir, ); - const warningCountBefore = await countApiReportWarnings(projectFolder); + const prefix = name === 'index' ? '' : `${name}-`; + const reportFileName = `${prefix}api-report.md`; + const reportPath = resolvePath(projectFolder, reportFileName); + + const warningCountBefore = await countApiReportWarnings(reportPath); const extractorConfig = ExtractorConfig.prepare({ configObject: { - mainEntryPointFilePath: resolvePath(packageFolder, 'src/index.d.ts'), + mainEntryPointFilePath: resolvePath(packageFolder, `src/${name}.d.ts`), bundledPackages: [], compiler: { @@ -362,16 +400,21 @@ export async function runApiExtraction({ apiReport: { enabled: true, - reportFileName: 'api-report.md', + reportFileName, reportFolder: projectFolder, - reportTempFolder: resolvePath(outputDir, ''), + reportTempFolder: resolvePath( + outputDir, + `${prefix}`, + ), }, docModel: { - enabled: true, + // TODO(Rugvip): This skips docs for non-index entry points. We can try to work around it, but + // most likely it makes sense to wait for API Extractor to natively support exports. + enabled: name === 'index', apiJsonFilePath: resolvePath( outputDir, - '.api.json', + `${prefix}.api.json`, ), }, @@ -461,6 +504,35 @@ export async function runApiExtraction({ compilerState, }); + // This release tag validation makes sure that the release tag of known entry points match expectations. + // The root index entrypoint is only allowed @public exports, while /alpha and /beta only allow @alpha and @beta. + if (validateReleaseTags && !usesExperimentalTypeBuild) { + if (['index', 'alpha', 'beta'].includes(name)) { + const report = await fs.readFile( + extractorConfig.reportFilePath, + 'utf8', + ); + const lines = report.split(/\r?\n/); + const expectedTag = name === 'index' ? 'public' : name; + for (let i = 0; i < lines.length; i += 1) { + const line = lines[i]; + const match = line.match(/^\/\/ @(alpha|beta|public)/); + if (match && match[1] !== expectedTag) { + // Because of limitations in the type script rollup logic we need to allow public exports from the other release stages + // TODO(Rugvip): Try to work around the need for this exception + if (expectedTag !== 'public' && match[1] === 'public') { + continue; + } + throw new Error( + `Unexpected release tag ${match[1]} in ${ + extractorConfig.reportFilePath + } at line ${i + 1}`, + ); + } + } + } + } + if (!extractorResult.succeeded) { if (shouldLogInstructions) { logApiReportInstructions(); @@ -488,7 +560,7 @@ export async function runApiExtraction({ ); } - const warningCountAfter = await countApiReportWarnings(projectFolder); + const warningCountAfter = await countApiReportWarnings(reportPath); if (noBail) { console.log(`Skipping warnings check for ${packageDir}`); } diff --git a/packages/repo-tools/src/commands/api-reports/api-reports.ts b/packages/repo-tools/src/commands/api-reports/api-reports.ts index 66436644d2..a917975750 100644 --- a/packages/repo-tools/src/commands/api-reports/api-reports.ts +++ b/packages/repo-tools/src/commands/api-reports/api-reports.ts @@ -33,6 +33,7 @@ type Options = { allowWarnings?: string; allowAllWarnings?: boolean; omitMessages?: string; + validateReleaseTags?: boolean; } & OptionValues; export const buildApiReports = async (paths: string[] = [], opts: Options) => { @@ -90,6 +91,7 @@ export const buildApiReports = async (paths: string[] = [], opts: Options) => { tsconfigFilePath, allowWarnings: allowAllWarnings || allowWarnings, omitMessages: Array.isArray(omitMessages) ? omitMessages : [], + validateReleaseTags: opts.validateReleaseTags, }); } if (cliPackageDirs.length > 0) { diff --git a/packages/repo-tools/src/commands/index.ts b/packages/repo-tools/src/commands/index.ts index f7a16b6d4e..f283e9c743 100644 --- a/packages/repo-tools/src/commands/index.ts +++ b/packages/repo-tools/src/commands/index.ts @@ -37,6 +37,10 @@ export function registerCommands(program: Command) { '-o, --omit-messages ', 'select some message code to be omited on the API Extractor (comma separated values i.e ae-cyclic-inherit-doc,ae-missing-getter )', ) + .option( + '--validate-release-tags', + 'Turn on release tag validation for the public, beta, and alpha APIs', + ) .description('Generate an API report for selected packages') .action( lazy(() => diff --git a/packages/repo-tools/src/commands/type-deps/type-deps.ts b/packages/repo-tools/src/commands/type-deps/type-deps.ts index 4f8e5e5529..17164cea39 100644 --- a/packages/repo-tools/src/commands/type-deps/type-deps.ts +++ b/packages/repo-tools/src/commands/type-deps/type-deps.ts @@ -20,6 +20,7 @@ import { resolve as resolvePath } from 'path'; // eslint-disable-next-line @backstage/no-undeclared-imports import chalk from 'chalk'; import { getPackages, Package } from '@manypkg/get-packages'; +import { getPackageExportNames } from '../../lib/entryPoints'; export default async () => { const { packages } = await getPackages(resolvePath('.')); @@ -96,16 +97,23 @@ function findAllDeps(declSrc: string) { * missing or incorrect in package.json */ function checkTypes(pkg: Package) { - const typeDecl = fs.readFileSync( - resolvePath(pkg.dir, 'dist/index.d.ts'), - 'utf8', - ); - const allDeps = findAllDeps(typeDecl); + const entryPointNames = getPackageExportNames(pkg.packageJson) ?? ['index']; + + const allDeps = entryPointNames.flatMap(name => { + const typeDecl = fs.readFileSync( + resolvePath(pkg.dir, `dist/${name}.d.ts`), + 'utf8', + ); + return findAllDeps(typeDecl); + }); const deps = Array.from(new Set(allDeps)); const errors = []; const typeDeps = []; - for (const dep of deps) { + for (let dep of deps) { + if (dep.endsWith('/*')) { + dep = dep.slice(0, -2); + } try { const typeDep = findTypesPackage(dep, pkg); if (typeDep) { diff --git a/packages/repo-tools/src/lib/entryPoints.ts b/packages/repo-tools/src/lib/entryPoints.ts new file mode 100644 index 0000000000..4a412d410b --- /dev/null +++ b/packages/repo-tools/src/lib/entryPoints.ts @@ -0,0 +1,39 @@ +/* + * 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 { extname } from 'path'; +import type { JsonObject } from '@backstage/types'; + +export function getPackageExportNames(pkg: JsonObject): string[] | undefined { + if (pkg.exports && typeof pkg.exports !== 'string') { + return Object.entries(pkg.exports).flatMap(([mount, path]) => { + const ext = extname(String(path)); + if (!['.ts', '.tsx', '.cts', '.mts'].includes(ext)) { + return []; // Ignore non-TS entry points + } + let name = mount; + if (name.startsWith('./')) { + name = name.slice(2); + } + if (!name || name === '.') { + return ['index']; + } + return [name]; + }); + } + + return undefined; +} diff --git a/packages/test-utils/alpha-api-report.md b/packages/test-utils/alpha-api-report.md new file mode 100644 index 0000000000..3e0c4aa6c2 --- /dev/null +++ b/packages/test-utils/alpha-api-report.md @@ -0,0 +1,14 @@ +## API Report File for "@backstage/test-utils" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { PropsWithChildren } from 'react'; + +// @alpha +export const MockPluginProvider: ({ + children, +}: PropsWithChildren<{}>) => JSX.Element; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/test-utils/api-report.md b/packages/test-utils/api-report.md index e11072f5a6..37650ff18a 100644 --- a/packages/test-utils/api-report.md +++ b/packages/test-utils/api-report.md @@ -26,7 +26,6 @@ import { JsonValue } from '@backstage/types'; import { MatcherFunction } from '@testing-library/react'; import { Observable } from '@backstage/types'; import { PermissionApi } from '@backstage/plugin-permission-react'; -import { PropsWithChildren } from 'react'; import { ReactElement } from 'react'; import { ReactNode } from 'react'; import { RenderOptions } from '@testing-library/react'; @@ -167,11 +166,6 @@ export class MockPermissionApi implements PermissionApi { ): Promise; } -// @alpha -export const MockPluginProvider: ({ - children, -}: PropsWithChildren<{}>) => JSX.Element; - // @public export class MockStorageApi implements StorageApi { // (undocumented) diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 9e82ccc1d7..192d58fd14 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -3,10 +3,22 @@ "description": "Utilities to test Backstage plugins and apps.", "version": "1.2.5", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "web-library" @@ -24,7 +36,7 @@ "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -60,7 +72,6 @@ "msw": "^0.49.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/packages/test-utils/src/alpha.ts b/packages/test-utils/src/alpha.ts new file mode 100644 index 0000000000..0b2a6a8d1c --- /dev/null +++ b/packages/test-utils/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 * from './testUtils/MockPluginProvider'; diff --git a/packages/test-utils/src/testUtils/providers.tsx b/packages/test-utils/src/testUtils/MockPluginProvider.tsx similarity index 89% rename from packages/test-utils/src/testUtils/providers.tsx rename to packages/test-utils/src/testUtils/MockPluginProvider.tsx index 8bc4b5122d..25442ae267 100644 --- a/packages/test-utils/src/testUtils/providers.tsx +++ b/packages/test-utils/src/testUtils/MockPluginProvider.tsx @@ -15,7 +15,8 @@ */ import React, { PropsWithChildren } from 'react'; -import { createPlugin, PluginProvider } from '@backstage/core-plugin-api'; +import { PluginProvider } from '@backstage/core-plugin-api/alpha'; +import { createPlugin } from '@backstage/core-plugin-api'; /** * Mock for PluginProvider to use in unit tests diff --git a/packages/test-utils/src/testUtils/index.tsx b/packages/test-utils/src/testUtils/index.tsx index 8fc1395eb8..1510af106e 100644 --- a/packages/test-utils/src/testUtils/index.tsx +++ b/packages/test-utils/src/testUtils/index.tsx @@ -25,7 +25,6 @@ export { export type { TestAppOptions } from './appWrappers'; export * from './msw'; export * from './logCollector'; -export * from './providers'; export * from './testingLibrary'; export { TestApiProvider, TestApiRegistry } from './TestApiProvider'; export type { TestApiProviderProps } from './TestApiProvider'; diff --git a/plugins/app-backend/alpha-api-report.md b/plugins/app-backend/alpha-api-report.md new file mode 100644 index 0000000000..20a2902557 --- /dev/null +++ b/plugins/app-backend/alpha-api-report.md @@ -0,0 +1,21 @@ +## API Report File for "@backstage/plugin-app-backend" + +> 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 express from 'express'; + +// @alpha +export const appPlugin: (options: AppPluginOptions) => BackendFeature; + +// @alpha (undocumented) +export type AppPluginOptions = { + appPackageName?: string; + staticFallbackHandler?: express.Handler; + disableConfigInjection?: boolean; + disableStaticFallbackCache?: boolean; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/app-backend/api-report.md b/plugins/app-backend/api-report.md index b52132ef51..0383129823 100644 --- a/plugins/app-backend/api-report.md +++ b/plugins/app-backend/api-report.md @@ -3,23 +3,11 @@ > 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 express from 'express'; import { Logger } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; -// @alpha -export const appPlugin: (options: AppPluginOptions) => BackendFeature; - -// @alpha (undocumented) -export type AppPluginOptions = { - appPackageName?: string; - staticFallbackHandler?: express.Handler; - disableConfigInjection?: boolean; - disableStaticFallbackCache?: boolean; -}; - // @public (undocumented) export function createRouter(options: RouterOptions): Promise; diff --git a/plugins/app-backend/package.json b/plugins/app-backend/package.json index 4b8f4ece73..ae2c61311c 100644 --- a/plugins/app-backend/package.json +++ b/plugins/app-backend/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -63,7 +75,6 @@ }, "files": [ "dist", - "alpha", "migrations/**/*.{js,d.ts}", "static" ] diff --git a/plugins/app-backend/src/alpha.ts b/plugins/app-backend/src/alpha.ts new file mode 100644 index 0000000000..cc8276b853 --- /dev/null +++ b/plugins/app-backend/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 { appPlugin } from './service/appPlugin'; +export type { AppPluginOptions } from './service/appPlugin'; diff --git a/plugins/app-backend/src/index.ts b/plugins/app-backend/src/index.ts index 167dc041fc..c91416eac1 100644 --- a/plugins/app-backend/src/index.ts +++ b/plugins/app-backend/src/index.ts @@ -21,5 +21,3 @@ */ export * from './service/router'; -export { appPlugin } from './service/appPlugin'; -export type { AppPluginOptions } from './service/appPlugin'; diff --git a/plugins/catalog-backend-module-aws/alpha-api-report.md b/plugins/catalog-backend-module-aws/alpha-api-report.md new file mode 100644 index 0000000000..8781975085 --- /dev/null +++ b/plugins/catalog-backend-module-aws/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-aws" + +> 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'; + +// @alpha +export const awsS3EntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-aws/api-report.md b/plugins/catalog-backend-module-aws/api-report.md index 1725692cb1..5086ec1ea7 100644 --- a/plugins/catalog-backend-module-aws/api-report.md +++ b/plugins/catalog-backend-module-aws/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 { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorParser } from '@backstage/plugin-catalog-backend'; @@ -88,7 +87,4 @@ export class AwsS3EntityProvider implements EntityProvider { // (undocumented) refresh(logger: Logger): Promise; } - -// @alpha -export const awsS3EntityProviderCatalogModule: () => BackendFeature; ``` diff --git a/plugins/catalog-backend-module-aws/package.json b/plugins/catalog-backend-module-aws/package.json index f583d64792..61cf55d546 100644 --- a/plugins/catalog-backend-module-aws/package.json +++ b/plugins/catalog-backend-module-aws/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -60,7 +72,6 @@ "yaml": "^2.0.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-aws/src/alpha.ts b/plugins/catalog-backend-module-aws/src/alpha.ts new file mode 100644 index 0000000000..3ae30df0cb --- /dev/null +++ b/plugins/catalog-backend-module-aws/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { awsS3EntityProviderCatalogModule } from './service/AwsS3EntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-aws/src/index.ts b/plugins/catalog-backend-module-aws/src/index.ts index 804fd97e91..212308edaa 100644 --- a/plugins/catalog-backend-module-aws/src/index.ts +++ b/plugins/catalog-backend-module-aws/src/index.ts @@ -22,5 +22,4 @@ export * from './processors'; export * from './providers'; -export { awsS3EntityProviderCatalogModule } from './service/AwsS3EntityProviderCatalogModule'; export * from './types'; diff --git a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.test.ts index c0d36ad3c2..868a9535b4 100644 --- a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { awsS3EntityProviderCatalogModule } from './AwsS3EntityProviderCatalogModule'; import { AwsS3EntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts index cbc137ab40..5d4170ec1c 100644 --- a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts @@ -19,7 +19,7 @@ import { coreServices, createBackendModule, } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { AwsS3EntityProvider } from '../providers'; /** diff --git a/plugins/catalog-backend-module-azure/alpha-api-report.md b/plugins/catalog-backend-module-azure/alpha-api-report.md new file mode 100644 index 0000000000..486aac7775 --- /dev/null +++ b/plugins/catalog-backend-module-azure/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-azure" + +> 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'; + +// @alpha +export const azureDevOpsEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-azure/api-report.md b/plugins/catalog-backend-module-azure/api-report.md index 5ffae14b6b..8fb7edeb53 100644 --- a/plugins/catalog-backend-module-azure/api-report.md +++ b/plugins/catalog-backend-module-azure/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 { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; @@ -56,7 +55,4 @@ export class AzureDevOpsEntityProvider implements EntityProvider { // (undocumented) refresh(logger: Logger): Promise; } - -// @alpha -export const azureDevOpsEntityProviderCatalogModule: () => BackendFeature; ``` diff --git a/plugins/catalog-backend-module-azure/package.json b/plugins/catalog-backend-module-azure/package.json index 518d7b89ad..ecaf9fb9cc 100644 --- a/plugins/catalog-backend-module-azure/package.json +++ b/plugins/catalog-backend-module-azure/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -56,7 +68,6 @@ "msw": "^0.49.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-azure/src/alpha.ts b/plugins/catalog-backend-module-azure/src/alpha.ts new file mode 100644 index 0000000000..cc3c4a83af --- /dev/null +++ b/plugins/catalog-backend-module-azure/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { azureDevOpsEntityProviderCatalogModule } from './service/AzureDevOpsEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-azure/src/index.ts b/plugins/catalog-backend-module-azure/src/index.ts index aa3a94fda2..a71c40ee6c 100644 --- a/plugins/catalog-backend-module-azure/src/index.ts +++ b/plugins/catalog-backend-module-azure/src/index.ts @@ -22,4 +22,3 @@ export { AzureDevOpsDiscoveryProcessor } from './processors'; export { AzureDevOpsEntityProvider } from './providers'; -export { azureDevOpsEntityProviderCatalogModule } from './service/AzureDevOpsEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.test.ts index a11e6b14f2..a8e526e871 100644 --- a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { azureDevOpsEntityProviderCatalogModule } from './AzureDevOpsEntityProviderCatalogModule'; import { AzureDevOpsEntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts index bd59cec29b..3fc1ddf3a4 100644 --- a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts @@ -19,7 +19,7 @@ import { createBackendModule, coreServices, } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { AzureDevOpsEntityProvider } from '../providers'; /** diff --git a/plugins/catalog-backend-module-bitbucket-cloud/alpha-api-report.md b/plugins/catalog-backend-module-bitbucket-cloud/alpha-api-report.md new file mode 100644 index 0000000000..77b4b77410 --- /dev/null +++ b/plugins/catalog-backend-module-bitbucket-cloud/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-bitbucket-cloud" + +> 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'; + +// @alpha (undocumented) +export const bitbucketCloudEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-bitbucket-cloud/api-report.md b/plugins/catalog-backend-module-bitbucket-cloud/api-report.md index 7ad6b3b3e0..456ea62dd3 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/api-report.md +++ b/plugins/catalog-backend-module-bitbucket-cloud/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 { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { EntityProvider } from '@backstage/plugin-catalog-backend'; @@ -46,7 +45,4 @@ export class BitbucketCloudEntityProvider // (undocumented) supportsEventTopics(): string[]; } - -// @alpha (undocumented) -export const bitbucketCloudEntityProviderCatalogModule: () => BackendFeature; ``` diff --git a/plugins/catalog-backend-module-bitbucket-cloud/package.json b/plugins/catalog-backend-module-bitbucket-cloud/package.json index d9b1c6613f..5d6c80a0cb 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/package.json +++ b/plugins/catalog-backend-module-bitbucket-cloud/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -56,7 +68,6 @@ "msw": "^0.49.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-bitbucket-cloud/src/alpha.ts b/plugins/catalog-backend-module-bitbucket-cloud/src/alpha.ts new file mode 100644 index 0000000000..e949dcb894 --- /dev/null +++ b/plugins/catalog-backend-module-bitbucket-cloud/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { bitbucketCloudEntityProviderCatalogModule } from './service/BitbucketCloudEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-bitbucket-cloud/src/index.ts b/plugins/catalog-backend-module-bitbucket-cloud/src/index.ts index c1f04b8877..1c15ad4e8f 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/src/index.ts +++ b/plugins/catalog-backend-module-bitbucket-cloud/src/index.ts @@ -21,4 +21,3 @@ */ export { BitbucketCloudEntityProvider } from './BitbucketCloudEntityProvider'; -export { bitbucketCloudEntityProviderCatalogModule } from './service/BitbucketCloudEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.test.ts index 1b18ab0ed9..630c18b134 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.test.ts @@ -20,8 +20,8 @@ import { TaskScheduleDefinition, } from '@backstage/backend-tasks'; import { startTestBackend, mockServices } from '@backstage/backend-test-utils'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { Duration } from 'luxon'; import { bitbucketCloudEntityProviderCatalogModule } from './BitbucketCloudEntityProviderCatalogModule'; import { BitbucketCloudEntityProvider } from '../BitbucketCloudEntityProvider'; diff --git a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts index d17656a473..a95d99ceef 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts @@ -22,8 +22,8 @@ import { import { catalogProcessingExtensionPoint, catalogServiceRef, -} from '@backstage/plugin-catalog-node'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +} from '@backstage/plugin-catalog-node/alpha'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { BitbucketCloudEntityProvider } from '../BitbucketCloudEntityProvider'; /** diff --git a/plugins/catalog-backend-module-bitbucket-server/alpha-api-report.md b/plugins/catalog-backend-module-bitbucket-server/alpha-api-report.md new file mode 100644 index 0000000000..3177828f51 --- /dev/null +++ b/plugins/catalog-backend-module-bitbucket-server/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-bitbucket-server" + +> 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'; + +// @alpha (undocumented) +export const bitbucketServerEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-bitbucket-server/api-report.md b/plugins/catalog-backend-module-bitbucket-server/api-report.md index 213f5d2573..6c840883af 100644 --- a/plugins/catalog-backend-module-bitbucket-server/api-report.md +++ b/plugins/catalog-backend-module-bitbucket-server/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 { BitbucketServerIntegrationConfig } from '@backstage/integration'; import { Config } from '@backstage/config'; import { Entity } from '@backstage/catalog-model'; @@ -68,9 +67,6 @@ export class BitbucketServerEntityProvider implements EntityProvider { refresh(logger: Logger): Promise; } -// @alpha (undocumented) -export const bitbucketServerEntityProviderCatalogModule: () => BackendFeature; - // @public (undocumented) export type BitbucketServerListOptions = { [key: string]: number | undefined; diff --git a/plugins/catalog-backend-module-bitbucket-server/package.json b/plugins/catalog-backend-module-bitbucket-server/package.json index fdfc5649a5..811dfe9f10 100644 --- a/plugins/catalog-backend-module-bitbucket-server/package.json +++ b/plugins/catalog-backend-module-bitbucket-server/package.json @@ -5,10 +5,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -24,7 +36,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -53,7 +65,6 @@ "msw": "^0.49.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-bitbucket-server/src/alpha.ts b/plugins/catalog-backend-module-bitbucket-server/src/alpha.ts new file mode 100644 index 0000000000..d6227c29f1 --- /dev/null +++ b/plugins/catalog-backend-module-bitbucket-server/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { bitbucketServerEntityProviderCatalogModule } from './service/BitbucketServerEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-bitbucket-server/src/index.ts b/plugins/catalog-backend-module-bitbucket-server/src/index.ts index f139078cfb..34ac3a9966 100644 --- a/plugins/catalog-backend-module-bitbucket-server/src/index.ts +++ b/plugins/catalog-backend-module-bitbucket-server/src/index.ts @@ -29,4 +29,3 @@ export type { } from './lib'; export { BitbucketServerEntityProvider } from './providers'; export type { BitbucketServerLocationParser } from './providers'; -export { bitbucketServerEntityProviderCatalogModule } from './service/BitbucketServerEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.test.ts index 474431dc7a..bdd7209364 100644 --- a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { TaskScheduleDefinition, } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { bitbucketServerEntityProviderCatalogModule } from './BitbucketServerEntityProviderCatalogModule'; import { Duration } from 'luxon'; import { BitbucketServerEntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts index 46712d29dd..deab47c9e9 100644 --- a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts @@ -19,7 +19,7 @@ import { coreServices, createBackendModule, } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { BitbucketServerEntityProvider } from '../providers'; /** diff --git a/plugins/catalog-backend-module-gerrit/alpha-api-report.md b/plugins/catalog-backend-module-gerrit/alpha-api-report.md new file mode 100644 index 0000000000..03f5d099b9 --- /dev/null +++ b/plugins/catalog-backend-module-gerrit/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-gerrit" + +> 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'; + +// @alpha (undocumented) +export const gerritEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-gerrit/api-report.md b/plugins/catalog-backend-module-gerrit/api-report.md index 870937f7ec..1dee786da1 100644 --- a/plugins/catalog-backend-module-gerrit/api-report.md +++ b/plugins/catalog-backend-module-gerrit/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 { EntityProvider } from '@backstage/plugin-catalog-backend'; import { EntityProviderConnection } from '@backstage/plugin-catalog-backend'; @@ -30,8 +29,5 @@ export class GerritEntityProvider implements EntityProvider { refresh(logger: Logger): Promise; } -// @alpha (undocumented) -export const gerritEntityProviderCatalogModule: () => BackendFeature; - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/catalog-backend-module-gerrit/package.json b/plugins/catalog-backend-module-gerrit/package.json index d945fed9fd..95978c2502 100644 --- a/plugins/catalog-backend-module-gerrit/package.json +++ b/plugins/catalog-backend-module-gerrit/package.json @@ -5,10 +5,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -21,7 +33,7 @@ }, "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", "prepack": "backstage-cli package prepack", diff --git a/plugins/catalog-backend-module-gerrit/src/alpha.ts b/plugins/catalog-backend-module-gerrit/src/alpha.ts new file mode 100644 index 0000000000..8b03d9312a --- /dev/null +++ b/plugins/catalog-backend-module-gerrit/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { gerritEntityProviderCatalogModule } from './service/GerritEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-gerrit/src/index.ts b/plugins/catalog-backend-module-gerrit/src/index.ts index 38ede69926..133772d4b1 100644 --- a/plugins/catalog-backend-module-gerrit/src/index.ts +++ b/plugins/catalog-backend-module-gerrit/src/index.ts @@ -15,4 +15,3 @@ */ export { GerritEntityProvider } from './providers/GerritEntityProvider'; -export { gerritEntityProviderCatalogModule } from './service/GerritEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.test.ts index 9d61cabdb9..51c1749c66 100644 --- a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { gerritEntityProviderCatalogModule } from './GerritEntityProviderCatalogModule'; import { GerritEntityProvider } from '../providers/GerritEntityProvider'; diff --git a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts index 8c61038c8f..782c724094 100644 --- a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts @@ -19,7 +19,7 @@ import { coreServices, createBackendModule, } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { GerritEntityProvider } from '../providers/GerritEntityProvider'; /** diff --git a/plugins/catalog-backend-module-github/alpha-api-report.md b/plugins/catalog-backend-module-github/alpha-api-report.md new file mode 100644 index 0000000000..eb13ec4558 --- /dev/null +++ b/plugins/catalog-backend-module-github/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-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'; + +// @alpha +export const githubEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-github/api-report.md b/plugins/catalog-backend-module-github/api-report.md index a66ec712c7..e2b73d267b 100644 --- a/plugins/catalog-backend-module-github/api-report.md +++ b/plugins/catalog-backend-module-github/api-report.md @@ -4,7 +4,6 @@ ```ts import { AnalyzeOptions } from '@backstage/plugin-catalog-backend'; -import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; @@ -100,9 +99,6 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber { supportsEventTopics(): string[]; } -// @alpha -export const githubEntityProviderCatalogModule: () => BackendFeature; - // @public (undocumented) export class GithubLocationAnalyzer implements ScmLocationAnalyzer { constructor(options: GithubLocationAnalyzerOptions); diff --git a/plugins/catalog-backend-module-github/package.json b/plugins/catalog-backend-module-github/package.json index 5d8c5f3659..ccf1be3b2a 100644 --- a/plugins/catalog-backend-module-github/package.json +++ b/plugins/catalog-backend-module-github/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -24,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -64,7 +76,6 @@ }, "files": [ "dist", - "alpha", "config.d.ts" ], "configSchema": "config.d.ts" diff --git a/plugins/catalog-backend-module-github/src/alpha.ts b/plugins/catalog-backend-module-github/src/alpha.ts new file mode 100644 index 0000000000..1b83eead82 --- /dev/null +++ b/plugins/catalog-backend-module-github/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { githubEntityProviderCatalogModule } from './service/GithubEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-github/src/index.ts b/plugins/catalog-backend-module-github/src/index.ts index b005780758..17c769419f 100644 --- a/plugins/catalog-backend-module-github/src/index.ts +++ b/plugins/catalog-backend-module-github/src/index.ts @@ -28,7 +28,6 @@ export { GithubOrgReaderProcessor } from './processors/GithubOrgReaderProcessor' export { GithubEntityProvider } from './providers/GithubEntityProvider'; export { GithubOrgEntityProvider } from './providers/GithubOrgEntityProvider'; export type { GithubOrgEntityProviderOptions } from './providers/GithubOrgEntityProvider'; -export { githubEntityProviderCatalogModule } from './service/GithubEntityProviderCatalogModule'; export { type GithubMultiOrgConfig, type GithubTeam, diff --git a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.test.ts index d8ebc8d0ad..7c08e8947d 100644 --- a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { githubEntityProviderCatalogModule } from './GithubEntityProviderCatalogModule'; import { GithubEntityProvider } from '../providers/GithubEntityProvider'; diff --git a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts index d9dc0a12aa..246f700248 100644 --- a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts @@ -19,11 +19,11 @@ import { coreServices, } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { GithubEntityProvider } from '../providers/GithubEntityProvider'; /** - * Registers the {@link GithubEntityProvider} with the catalog processing extension point. + * Registers the `GithubEntityProvider` with the catalog processing extension point. * * @alpha */ diff --git a/plugins/catalog-backend-module-gitlab/alpha-api-report.md b/plugins/catalog-backend-module-gitlab/alpha-api-report.md new file mode 100644 index 0000000000..8912b4a7b2 --- /dev/null +++ b/plugins/catalog-backend-module-gitlab/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-gitlab" + +> 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'; + +// @alpha +export const gitlabDiscoveryEntityProviderCatalogModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-gitlab/api-report.md b/plugins/catalog-backend-module-gitlab/api-report.md index 0195975d4b..68ea45169f 100644 --- a/plugins/catalog-backend-module-gitlab/api-report.md +++ b/plugins/catalog-backend-module-gitlab/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 { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; @@ -33,9 +32,6 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider { refresh(logger: Logger): Promise; } -// @alpha -export const gitlabDiscoveryEntityProviderCatalogModule: () => BackendFeature; - // @public export class GitLabDiscoveryProcessor implements CatalogProcessor { // (undocumented) diff --git a/plugins/catalog-backend-module-gitlab/package.json b/plugins/catalog-backend-module-gitlab/package.json index 4fb26eeb7e..cbd07944d9 100644 --- a/plugins/catalog-backend-module-gitlab/package.json +++ b/plugins/catalog-backend-module-gitlab/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -57,7 +69,6 @@ "msw": "^0.49.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-gitlab/src/alpha.ts b/plugins/catalog-backend-module-gitlab/src/alpha.ts new file mode 100644 index 0000000000..883ffc13c4 --- /dev/null +++ b/plugins/catalog-backend-module-gitlab/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { gitlabDiscoveryEntityProviderCatalogModule } from './service/GitlabDiscoveryEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-gitlab/src/index.ts b/plugins/catalog-backend-module-gitlab/src/index.ts index 30efac4924..2dd19c041d 100644 --- a/plugins/catalog-backend-module-gitlab/src/index.ts +++ b/plugins/catalog-backend-module-gitlab/src/index.ts @@ -25,4 +25,3 @@ export { GitlabDiscoveryEntityProvider, GitlabOrgDiscoveryEntityProvider, } from './providers'; -export { gitlabDiscoveryEntityProviderCatalogModule } from './service/GitlabDiscoveryEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.test.ts index ca8d86f555..efb86e4223 100644 --- a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { gitlabDiscoveryEntityProviderCatalogModule } from './GitlabDiscoveryEntityProviderCatalogModule'; import { GitlabDiscoveryEntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts index bb4fb656a8..0adf5b18f2 100644 --- a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts @@ -19,7 +19,7 @@ import { coreServices, } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { GitlabDiscoveryEntityProvider } from '../providers'; /** diff --git a/plugins/catalog-backend-module-incremental-ingestion/alpha-api-report.md b/plugins/catalog-backend-module-incremental-ingestion/alpha-api-report.md new file mode 100644 index 0000000000..ec9c59a4c4 --- /dev/null +++ b/plugins/catalog-backend-module-incremental-ingestion/alpha-api-report.md @@ -0,0 +1,19 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-incremental-ingestion" + +> 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 { IncrementalEntityProvider } from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; +import { IncrementalEntityProviderOptions } from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; + +// @alpha +export const incrementalIngestionEntityProviderCatalogModule: (options: { + providers: { + provider: IncrementalEntityProvider; + options: IncrementalEntityProviderOptions; + }[]; +}) => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-incremental-ingestion/api-report.md b/plugins/catalog-backend-module-incremental-ingestion/api-report.md index fe9ef24777..167c07f70f 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/api-report.md +++ b/plugins/catalog-backend-module-incremental-ingestion/api-report.md @@ -5,7 +5,6 @@ ```ts /// -import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogBuilder } from '@backstage/plugin-catalog-backend'; import type { Config } from '@backstage/config'; import type { DeferredEntity } from '@backstage/plugin-catalog-backend'; @@ -80,14 +79,6 @@ export interface IncrementalEntityProviderOptions { restLength: DurationObjectUnits; } -// @alpha -export const incrementalIngestionEntityProviderCatalogModule: (options: { - providers: { - provider: IncrementalEntityProvider; - options: IncrementalEntityProviderOptions; - }[]; -}) => BackendFeature; - // @public (undocumented) export type PluginEnvironment = { logger: Logger; diff --git a/plugins/catalog-backend-module-incremental-ingestion/package.json b/plugins/catalog-backend-module-incremental-ingestion/package.json index ff8272e29e..5f49cb8905 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/package.json +++ b/plugins/catalog-backend-module-incremental-ingestion/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", @@ -61,7 +73,6 @@ "@backstage/plugin-catalog-backend": "workspace:^" }, "files": [ - "alpha", "dist", "migrations/**/*.{js,d.ts}" ] diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/alpha.ts b/plugins/catalog-backend-module-incremental-ingestion/src/alpha.ts new file mode 100644 index 0000000000..c277a0a680 --- /dev/null +++ b/plugins/catalog-backend-module-incremental-ingestion/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 * from './module'; diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/index.ts b/plugins/catalog-backend-module-incremental-ingestion/src/index.ts index 976c91a1ce..ff1ee1faa1 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/index.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/index.ts @@ -20,7 +20,6 @@ * @packageDocumentation */ -export * from './module'; export * from './service'; export { type EntityIteratorResult, diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.test.ts index 06cbcb010e..dbadf573a4 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.test.ts @@ -18,7 +18,7 @@ import { getVoidLogger } from '@backstage/backend-common'; import { coreServices } from '@backstage/backend-plugin-api'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { IncrementalEntityProvider } from '../types'; import { incrementalIngestionEntityProviderCatalogModule } from './incrementalIngestionEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.ts index b173b2d2ef..261768c142 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/module/incrementalIngestionEntityProviderCatalogModule.ts @@ -18,11 +18,11 @@ import { coreServices, createBackendModule, } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { IncrementalEntityProvider, IncrementalEntityProviderOptions, -} from '../types'; +} from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; import { WrapperProviders } from './WrapperProviders'; /** diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/run.ts b/plugins/catalog-backend-module-incremental-ingestion/src/run.ts index eb66140fe2..c94af368d1 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/run.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/run.ts @@ -19,11 +19,9 @@ import { createServiceFactory, } from '@backstage/backend-plugin-api'; import { ConfigReader } from '@backstage/config'; -import { catalogPlugin } from '@backstage/plugin-catalog-backend'; -import { - IncrementalEntityProvider, - incrementalIngestionEntityProviderCatalogModule, -} from '.'; +import { catalogPlugin } from '@backstage/plugin-catalog-backend/alpha'; +import { IncrementalEntityProvider } from '.'; +import { incrementalIngestionEntityProviderCatalogModule } from './alpha'; const provider: IncrementalEntityProvider = { getProviderName: () => 'test-provider', diff --git a/plugins/catalog-backend-module-msgraph/alpha-api-report.md b/plugins/catalog-backend-module-msgraph/alpha-api-report.md new file mode 100644 index 0000000000..ed30b83bc8 --- /dev/null +++ b/plugins/catalog-backend-module-msgraph/alpha-api-report.md @@ -0,0 +1,24 @@ +## API Report File for "@backstage/plugin-catalog-backend-module-msgraph" + +> 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 { GroupTransformer } from '@backstage/plugin-catalog-backend-module-msgraph'; +import { OrganizationTransformer } from '@backstage/plugin-catalog-backend-module-msgraph'; +import { UserTransformer } from '@backstage/plugin-catalog-backend-module-msgraph'; + +// @alpha +export const microsoftGraphOrgEntityProviderCatalogModule: () => BackendFeature; + +// @alpha +export interface MicrosoftGraphOrgEntityProviderCatalogModuleOptions { + groupTransformer?: GroupTransformer | Record; + organizationTransformer?: + | OrganizationTransformer + | Record; + userTransformer?: UserTransformer | Record; +} + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend-module-msgraph/api-report.md b/plugins/catalog-backend-module-msgraph/api-report.md index 09770614b4..10a4f405c0 100644 --- a/plugins/catalog-backend-module-msgraph/api-report.md +++ b/plugins/catalog-backend-module-msgraph/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 { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; @@ -139,18 +138,6 @@ export class MicrosoftGraphOrgEntityProvider implements EntityProvider { read(options?: { logger?: Logger }): Promise; } -// @alpha -export const microsoftGraphOrgEntityProviderCatalogModule: () => BackendFeature; - -// @alpha -export interface MicrosoftGraphOrgEntityProviderCatalogModuleOptions { - groupTransformer?: GroupTransformer | Record; - organizationTransformer?: - | OrganizationTransformer - | Record; - userTransformer?: UserTransformer | Record; -} - // @public @deprecated export interface MicrosoftGraphOrgEntityProviderLegacyOptions { groupTransformer?: GroupTransformer; diff --git a/plugins/catalog-backend-module-msgraph/package.json b/plugins/catalog-backend-module-msgraph/package.json index 65a58e2620..1cc3855d77 100644 --- a/plugins/catalog-backend-module-msgraph/package.json +++ b/plugins/catalog-backend-module-msgraph/package.json @@ -6,10 +6,22 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin-module" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -59,7 +71,6 @@ "msw": "^0.49.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/catalog-backend-module-msgraph/src/alpha.ts b/plugins/catalog-backend-module-msgraph/src/alpha.ts new file mode 100644 index 0000000000..137808d881 --- /dev/null +++ b/plugins/catalog-backend-module-msgraph/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 { microsoftGraphOrgEntityProviderCatalogModule } from './service/MicrosoftGraphOrgEntityProviderCatalogModule'; +export type { MicrosoftGraphOrgEntityProviderCatalogModuleOptions } from './service/MicrosoftGraphOrgEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-msgraph/src/index.ts b/plugins/catalog-backend-module-msgraph/src/index.ts index b80a0b3863..f98cb907ec 100644 --- a/plugins/catalog-backend-module-msgraph/src/index.ts +++ b/plugins/catalog-backend-module-msgraph/src/index.ts @@ -22,5 +22,3 @@ export * from './microsoftGraph'; export * from './processors'; -export { microsoftGraphOrgEntityProviderCatalogModule } from './service/MicrosoftGraphOrgEntityProviderCatalogModule'; -export type { MicrosoftGraphOrgEntityProviderCatalogModuleOptions } from './service/MicrosoftGraphOrgEntityProviderCatalogModule'; diff --git a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.test.ts b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.test.ts index 27ae5b9dd8..3763553162 100644 --- a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.test.ts +++ b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.test.ts @@ -22,7 +22,7 @@ import { } from '@backstage/backend-tasks'; import { startTestBackend } from '@backstage/backend-test-utils'; import { ConfigReader } from '@backstage/config'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { Duration } from 'luxon'; import { microsoftGraphOrgEntityProviderCatalogModule } from './MicrosoftGraphOrgEntityProviderCatalogModule'; import { MicrosoftGraphOrgEntityProvider } from '../processors'; diff --git a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts index fc63867a23..11be567045 100644 --- a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts @@ -19,12 +19,12 @@ import { createBackendModule, } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { GroupTransformer, OrganizationTransformer, UserTransformer, -} from '../microsoftGraph'; +} from '@backstage/plugin-catalog-backend-module-msgraph'; import { MicrosoftGraphOrgEntityProvider } from '../processors'; /** diff --git a/plugins/catalog-backend/alpha-api-report.md b/plugins/catalog-backend/alpha-api-report.md new file mode 100644 index 0000000000..df2fa3d2e9 --- /dev/null +++ b/plugins/catalog-backend/alpha-api-report.md @@ -0,0 +1,156 @@ +## API Report File for "@backstage/plugin-catalog-backend" + +> 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 { ConditionalPolicyDecision } from '@backstage/plugin-permission-common'; +import { Conditions } from '@backstage/plugin-permission-node'; +import { Entity } from '@backstage/catalog-model'; +import { PermissionCondition } from '@backstage/plugin-permission-common'; +import { PermissionCriteria } from '@backstage/plugin-permission-common'; +import { PermissionRule } from '@backstage/plugin-permission-node'; +import { PermissionRuleParams } from '@backstage/plugin-permission-common'; +import { ResourcePermission } from '@backstage/plugin-permission-common'; + +// @alpha +export const catalogConditions: Conditions<{ + hasAnnotation: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + annotation: string; + } + >; + hasLabel: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + label: string; + } + >; + hasMetadata: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + key: string; + } + >; + hasSpec: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + key: string; + } + >; + isEntityKind: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + kinds: string[]; + } + >; + isEntityOwner: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + claims: string[]; + } + >; +}>; + +// @alpha +export type CatalogPermissionRule< + TParams extends PermissionRuleParams = PermissionRuleParams, +> = PermissionRule; + +// @alpha +export const catalogPlugin: () => BackendFeature; + +// @alpha +export const createCatalogConditionalDecision: ( + permission: ResourcePermission<'catalog-entity'>, + conditions: PermissionCriteria< + PermissionCondition<'catalog-entity', PermissionRuleParams> + >, +) => ConditionalPolicyDecision; + +// @alpha +export const createCatalogPermissionRule: < + TParams extends PermissionRuleParams = undefined, +>( + rule: PermissionRule, +) => PermissionRule; + +// @public +export type EntitiesSearchFilter = { + key: string; + values?: string[]; +}; + +// @alpha +export const permissionRules: { + hasAnnotation: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + annotation: string; + } + >; + hasLabel: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + label: string; + } + >; + hasMetadata: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + key: string; + } + >; + hasSpec: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + value?: string | undefined; + key: string; + } + >; + isEntityKind: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + kinds: string[]; + } + >; + isEntityOwner: PermissionRule< + Entity, + EntitiesSearchFilter, + 'catalog-entity', + { + claims: string[]; + } + >; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md index f15f6b9ba9..00c13a31ea 100644 --- a/plugins/catalog-backend/api-report.md +++ b/plugins/catalog-backend/api-report.md @@ -10,7 +10,6 @@ import { AnalyzeLocationExistingEntity as AnalyzeLocationExistingEntity_2 } from import { AnalyzeLocationGenerateEntity as AnalyzeLocationGenerateEntity_2 } from '@backstage/plugin-catalog-common'; import { AnalyzeLocationRequest as AnalyzeLocationRequest_2 } from '@backstage/plugin-catalog-common'; import { AnalyzeLocationResponse as AnalyzeLocationResponse_2 } from '@backstage/plugin-catalog-common'; -import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; import { CatalogEntityDocument } from '@backstage/plugin-catalog-common'; import { CatalogProcessor } from '@backstage/plugin-catalog-node'; @@ -23,8 +22,6 @@ import { CatalogProcessorParser } from '@backstage/plugin-catalog-node'; import { CatalogProcessorRefreshKeysResult } from '@backstage/plugin-catalog-node'; import { CatalogProcessorRelationResult } from '@backstage/plugin-catalog-node'; import { CatalogProcessorResult } from '@backstage/plugin-catalog-node'; -import { ConditionalPolicyDecision } from '@backstage/plugin-permission-common'; -import { Conditions } from '@backstage/plugin-permission-node'; import { Config } from '@backstage/config'; import { DeferredEntity } from '@backstage/plugin-catalog-node'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; @@ -41,8 +38,6 @@ import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common import { Logger } from 'winston'; import { Permission } from '@backstage/plugin-permission-common'; import { PermissionAuthorizer } from '@backstage/plugin-permission-common'; -import { PermissionCondition } from '@backstage/plugin-permission-common'; -import { PermissionCriteria } from '@backstage/plugin-permission-common'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; import { PermissionRule } from '@backstage/plugin-permission-node'; import { PermissionRuleParams } from '@backstage/plugin-permission-common'; @@ -50,7 +45,6 @@ import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { processingResult } from '@backstage/plugin-catalog-node'; import { Readable } from 'stream'; -import { ResourcePermission } from '@backstage/plugin-permission-common'; import { Router } from 'express'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { TokenManager } from '@backstage/backend-common'; @@ -128,10 +122,9 @@ export class CatalogBuilder { addLocationAnalyzers( ...analyzers: Array> ): CatalogBuilder; - // @alpha addPermissionRules( ...permissionRules: Array< - CatalogPermissionRule | Array + CatalogPermissionRuleInput | Array > ): this; addProcessor( @@ -172,61 +165,6 @@ export type CatalogCollatorEntityTransformer = ( entity: Entity, ) => Omit; -// @alpha -export const catalogConditions: Conditions<{ - hasAnnotation: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - annotation: string; - } - >; - hasLabel: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - label: string; - } - >; - hasMetadata: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - key: string; - } - >; - hasSpec: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - key: string; - } - >; - isEntityKind: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - kinds: string[]; - } - >; - isEntityOwner: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - claims: string[]; - } - >; -}>; - // @public (undocumented) export type CatalogEnvironment = { logger: Logger; @@ -236,14 +174,11 @@ export type CatalogEnvironment = { permissions: PermissionEvaluator | PermissionAuthorizer; }; -// @alpha -export type CatalogPermissionRule< +// @public +export type CatalogPermissionRuleInput< TParams extends PermissionRuleParams = PermissionRuleParams, > = PermissionRule; -// @alpha -export const catalogPlugin: () => BackendFeature; - // @public export interface CatalogProcessingEngine { // (undocumented) @@ -293,21 +228,6 @@ export class CodeOwnersProcessor implements CatalogProcessor { preProcessEntity(entity: Entity, location: LocationSpec_2): Promise; } -// @alpha -export const createCatalogConditionalDecision: ( - permission: ResourcePermission<'catalog-entity'>, - conditions: PermissionCriteria< - PermissionCondition<'catalog-entity', PermissionRuleParams> - >, -) => ConditionalPolicyDecision; - -// @alpha -export const createCatalogPermissionRule: < - TParams extends PermissionRuleParams = undefined, ->( - rule: PermissionRule, -) => PermissionRule; - // @public export function createRandomProcessingInterval(options: { minSeconds: number; @@ -466,61 +386,6 @@ export function parseEntityYaml( location: LocationSpec_2, ): Iterable; -// @alpha -export const permissionRules: { - hasAnnotation: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - annotation: string; - } - >; - hasLabel: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - label: string; - } - >; - hasMetadata: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - key: string; - } - >; - hasSpec: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - value?: string | undefined; - key: string; - } - >; - isEntityKind: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - kinds: string[]; - } - >; - isEntityOwner: PermissionRule< - Entity, - EntitiesSearchFilter, - 'catalog-entity', - { - claims: string[]; - } - >; -}; - // @public export class PlaceholderProcessor implements CatalogProcessor { constructor(options: PlaceholderProcessorOptions); diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 297242d6e8..17e9c9aa7c 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -88,7 +100,6 @@ }, "files": [ "dist", - "alpha", "migrations/**/*.{js,d.ts}", "config.d.ts" ], diff --git a/plugins/catalog-backend/src/alpha.ts b/plugins/catalog-backend/src/alpha.ts new file mode 100644 index 0000000000..aa1309aecd --- /dev/null +++ b/plugins/catalog-backend/src/alpha.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +// TODO(Rugvip): Re-exported for alpha types as the API report will otherwise +// produce warnings due to the indirect dependency. We be nice to avoid. +import type { EntitiesSearchFilter } from './catalog/types'; + +export type { /** @alpha */ EntitiesSearchFilter }; + +export * from './permissions'; +export { catalogPlugin } from './service/CatalogPlugin'; diff --git a/plugins/catalog-backend/src/index.ts b/plugins/catalog-backend/src/index.ts index 000dd94e8b..e52336f036 100644 --- a/plugins/catalog-backend/src/index.ts +++ b/plugins/catalog-backend/src/index.ts @@ -42,7 +42,6 @@ export { processingResult } from '@backstage/plugin-catalog-node'; export * from './catalog'; export * from './ingestion'; export * from './modules'; -export * from './permissions'; export * from './processing'; export * from './search'; export * from './service'; diff --git a/plugins/catalog-backend/src/permissions/conditionExports.ts b/plugins/catalog-backend/src/permissions/conditionExports.ts index 1c1ba70631..c9406cdc0e 100644 --- a/plugins/catalog-backend/src/permissions/conditionExports.ts +++ b/plugins/catalog-backend/src/permissions/conditionExports.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { createConditionExports } from '@backstage/plugin-permission-node'; import { permissionRules } from './rules'; diff --git a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts index fd51a1a060..73f40da8c8 100644 --- a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts +++ b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts @@ -15,7 +15,7 @@ */ import { get } from 'lodash'; -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { createCatalogPermissionRule } from './util'; import { z } from 'zod'; diff --git a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts index ae9b1c3963..315d7fa8d0 100644 --- a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts +++ b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { z } from 'zod'; import { createCatalogPermissionRule } from './util'; diff --git a/plugins/catalog-backend/src/permissions/rules/hasLabel.ts b/plugins/catalog-backend/src/permissions/rules/hasLabel.ts index 16c5917585..2d6289dd26 100644 --- a/plugins/catalog-backend/src/permissions/rules/hasLabel.ts +++ b/plugins/catalog-backend/src/permissions/rules/hasLabel.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { z } from 'zod'; import { createCatalogPermissionRule } from './util'; diff --git a/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts b/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts index 94aaa63567..8ebad5521c 100644 --- a/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts +++ b/plugins/catalog-backend/src/permissions/rules/isEntityKind.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { z } from 'zod'; import { EntitiesSearchFilter } from '../../catalog/types'; import { createCatalogPermissionRule } from './util'; diff --git a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts index d0cc1d9280..86493315dc 100644 --- a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts +++ b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.ts @@ -15,7 +15,7 @@ */ import { RELATION_OWNED_BY } from '@backstage/catalog-model'; -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { z } from 'zod'; import { createCatalogPermissionRule } from './util'; diff --git a/plugins/catalog-backend/src/permissions/rules/util.ts b/plugins/catalog-backend/src/permissions/rules/util.ts index ea25e115d2..466f5ce70b 100644 --- a/plugins/catalog-backend/src/permissions/rules/util.ts +++ b/plugins/catalog-backend/src/permissions/rules/util.ts @@ -15,7 +15,7 @@ */ import { Entity } from '@backstage/catalog-model'; -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { PermissionRuleParams } from '@backstage/plugin-permission-common'; import { makeCreatePermissionRule, diff --git a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts index 70ec0ee948..42c6930422 100644 --- a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts +++ b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts @@ -29,10 +29,8 @@ import { CatalogClient, GetEntitiesRequest, } from '@backstage/catalog-client'; -import { - catalogEntityReadPermission, - CatalogEntityDocument, -} from '@backstage/plugin-catalog-common'; +import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha'; +import { CatalogEntityDocument } from '@backstage/plugin-catalog-common'; import { Permission } from '@backstage/plugin-permission-common'; /** diff --git a/plugins/catalog-backend/src/search/DefaultCatalogCollatorFactory.ts b/plugins/catalog-backend/src/search/DefaultCatalogCollatorFactory.ts index 1c03836e51..ed81d39bbb 100644 --- a/plugins/catalog-backend/src/search/DefaultCatalogCollatorFactory.ts +++ b/plugins/catalog-backend/src/search/DefaultCatalogCollatorFactory.ts @@ -25,10 +25,8 @@ import { GetEntitiesRequest, } from '@backstage/catalog-client'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; -import { - catalogEntityReadPermission, - CatalogEntityDocument, -} from '@backstage/plugin-catalog-common'; +import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha'; +import { CatalogEntityDocument } from '@backstage/plugin-catalog-common'; import { Permission } from '@backstage/plugin-permission-common'; import { Readable } from 'stream'; import { CatalogCollatorEntityTransformer } from './CatalogCollatorEntityTransformer'; diff --git a/plugins/catalog-backend/src/service/AuthorizedEntitiesCatalog.ts b/plugins/catalog-backend/src/service/AuthorizedEntitiesCatalog.ts index 2649b45260..0ce1ee87e7 100644 --- a/plugins/catalog-backend/src/service/AuthorizedEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/AuthorizedEntitiesCatalog.ts @@ -18,7 +18,7 @@ import { NotAllowedError } from '@backstage/errors'; import { catalogEntityDeletePermission, catalogEntityReadPermission, -} from '@backstage/plugin-catalog-common'; +} from '@backstage/plugin-catalog-common/alpha'; import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; import { AuthorizeResult, diff --git a/plugins/catalog-backend/src/service/AuthorizedLocationService.ts b/plugins/catalog-backend/src/service/AuthorizedLocationService.ts index a73597649e..68bb1553a8 100644 --- a/plugins/catalog-backend/src/service/AuthorizedLocationService.ts +++ b/plugins/catalog-backend/src/service/AuthorizedLocationService.ts @@ -21,7 +21,7 @@ import { catalogLocationCreatePermission, catalogLocationDeletePermission, catalogLocationReadPermission, -} from '@backstage/plugin-catalog-common'; +} from '@backstage/plugin-catalog-common/alpha'; import { AuthorizeResult, PermissionEvaluator, diff --git a/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts b/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts index 8634fbf86d..cbc728750a 100644 --- a/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts +++ b/plugins/catalog-backend/src/service/AuthorizedRefreshService.ts @@ -15,7 +15,7 @@ */ import { NotAllowedError } from '@backstage/errors'; -import { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityRefreshPermission } from '@backstage/plugin-catalog-common/alpha'; import { AuthorizeResult, PermissionEvaluator, diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.ts b/plugins/catalog-backend/src/service/CatalogBuilder.ts index 3dfdec09e5..7da5d69767 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.ts @@ -76,10 +76,10 @@ import { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules'; import { Config } from '@backstage/config'; import { Logger } from 'winston'; import { connectEntityProviders } from '../processing/connectEntityProviders'; -import { - CatalogPermissionRule, - permissionRules as catalogPermissionRules, -} from '../permissions/rules'; +import { PermissionRuleParams } from '@backstage/plugin-permission-common'; +import { EntitiesSearchFilter } from '../catalog/types'; +import { permissionRules as catalogPermissionRules } from '../permissions/rules'; +import { PermissionRule } from '@backstage/plugin-permission-node'; import { PermissionAuthorizer, PermissionEvaluator, @@ -94,11 +94,20 @@ import { basicEntityFilter } from './request/basicEntityFilter'; import { catalogPermissions, RESOURCE_TYPE_CATALOG_ENTITY, -} from '@backstage/plugin-catalog-common'; +} from '@backstage/plugin-catalog-common/alpha'; import { AuthorizedLocationService } from './AuthorizedLocationService'; import { DefaultProviderDatabase } from '../database/DefaultProviderDatabase'; import { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase'; +/** + * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API. + * + * @public + */ +export type CatalogPermissionRuleInput< + TParams extends PermissionRuleParams = PermissionRuleParams, +> = PermissionRule; + /** @public */ export type CatalogEnvironment = { logger: Logger; @@ -154,7 +163,7 @@ export class CatalogBuilder { maxSeconds: 150, }); private locationAnalyzer: LocationAnalyzer | undefined = undefined; - private readonly permissionRules: CatalogPermissionRule[]; + private readonly permissionRules: CatalogPermissionRuleInput[]; private allowedLocationType: string[]; private legacySingleProcessorValidation = false; @@ -379,11 +388,10 @@ export class CatalogBuilder { * {@link @backstage/plugin-permission-node#PermissionRule}. * * @param permissionRules - Additional permission rules - * @alpha */ addPermissionRules( ...permissionRules: Array< - CatalogPermissionRule | Array + CatalogPermissionRuleInput | Array > ) { this.permissionRules.push(...permissionRules.flat()); diff --git a/plugins/catalog-backend/src/service/CatalogPlugin.ts b/plugins/catalog-backend/src/service/CatalogPlugin.ts index 5abb630668..a6b164001c 100644 --- a/plugins/catalog-backend/src/service/CatalogPlugin.ts +++ b/plugins/catalog-backend/src/service/CatalogPlugin.ts @@ -19,9 +19,11 @@ import { } from '@backstage/backend-plugin-api'; import { CatalogBuilder } from './CatalogBuilder'; import { - CatalogProcessor, CatalogProcessingExtensionPoint, catalogProcessingExtensionPoint, +} from '@backstage/plugin-catalog-node/alpha'; +import { + CatalogProcessor, EntityProvider, } from '@backstage/plugin-catalog-node'; import { loggerToWinstonLogger } from '@backstage/backend-common'; diff --git a/plugins/catalog-backend/src/service/createRouter.test.ts b/plugins/catalog-backend/src/service/createRouter.test.ts index f2f87fa800..df934eae68 100644 --- a/plugins/catalog-backend/src/service/createRouter.test.ts +++ b/plugins/catalog-backend/src/service/createRouter.test.ts @@ -34,7 +34,7 @@ import { createPermissionIntegrationRouter, createPermissionRule, } from '@backstage/plugin-permission-node'; -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { CatalogProcessingOrchestrator } from '../processing/types'; import { z } from 'zod'; import { encodeCursor } from './util'; diff --git a/plugins/catalog-backend/src/service/index.ts b/plugins/catalog-backend/src/service/index.ts index 7e0c6025c3..44645d39fe 100644 --- a/plugins/catalog-backend/src/service/index.ts +++ b/plugins/catalog-backend/src/service/index.ts @@ -14,6 +14,8 @@ * limitations under the License. */ -export type { CatalogEnvironment } from './CatalogBuilder'; +export type { + CatalogEnvironment, + CatalogPermissionRuleInput, +} from './CatalogBuilder'; export { CatalogBuilder } from './CatalogBuilder'; -export { catalogPlugin } from './CatalogPlugin'; diff --git a/plugins/catalog-backend/src/stitching/Stitcher.ts b/plugins/catalog-backend/src/stitching/Stitcher.ts index bdf9f8791a..38d0fd263f 100644 --- a/plugins/catalog-backend/src/stitching/Stitcher.ts +++ b/plugins/catalog-backend/src/stitching/Stitcher.ts @@ -15,12 +15,11 @@ */ import { ENTITY_STATUS_CATALOG_PROCESSING_TYPE } from '@backstage/catalog-client'; +import { AlphaEntity, EntityStatusItem } from '@backstage/catalog-model/alpha'; import { - AlphaEntity, ANNOTATION_EDIT_URL, ANNOTATION_VIEW_URL, EntityRelation, - EntityStatusItem, } from '@backstage/catalog-model'; import { SerializedError, stringifyError } from '@backstage/errors'; import { Knex } from 'knex'; diff --git a/plugins/catalog-common/alpha-api-report.md b/plugins/catalog-common/alpha-api-report.md new file mode 100644 index 0000000000..12e0806a9c --- /dev/null +++ b/plugins/catalog-common/alpha-api-report.md @@ -0,0 +1,45 @@ +## API Report File for "@backstage/plugin-catalog-common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BasicPermission } from '@backstage/plugin-permission-common'; +import { ResourcePermission } from '@backstage/plugin-permission-common'; + +// @alpha +export const catalogEntityCreatePermission: BasicPermission; + +// @alpha +export const catalogEntityDeletePermission: ResourcePermission<'catalog-entity'>; + +// @alpha +export type CatalogEntityPermission = ResourcePermission< + typeof RESOURCE_TYPE_CATALOG_ENTITY +>; + +// @alpha +export const catalogEntityReadPermission: ResourcePermission<'catalog-entity'>; + +// @alpha +export const catalogEntityRefreshPermission: ResourcePermission<'catalog-entity'>; + +// @alpha +export const catalogLocationCreatePermission: BasicPermission; + +// @alpha +export const catalogLocationDeletePermission: BasicPermission; + +// @alpha +export const catalogLocationReadPermission: BasicPermission; + +// @alpha +export const catalogPermissions: ( + | BasicPermission + | ResourcePermission<'catalog-entity'> +)[]; + +// @alpha +export const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity'; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-common/api-report.md b/plugins/catalog-common/api-report.md index 1bef626c79..231c8aac34 100644 --- a/plugins/catalog-common/api-report.md +++ b/plugins/catalog-common/api-report.md @@ -3,10 +3,8 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { BasicPermission } from '@backstage/plugin-permission-common'; import { Entity } from '@backstage/catalog-model'; import { IndexableDocument } from '@backstage/plugin-search-common'; -import { ResourcePermission } from '@backstage/plugin-permission-common'; // @public (undocumented) export type AnalyzeLocationEntityField = { @@ -44,12 +42,6 @@ export type AnalyzeLocationResponse = { generateEntities: AnalyzeLocationGenerateEntity[]; }; -// @alpha -export const catalogEntityCreatePermission: BasicPermission; - -// @alpha -export const catalogEntityDeletePermission: ResourcePermission<'catalog-entity'>; - // @public export interface CatalogEntityDocument extends IndexableDocument { // @deprecated (undocumented) @@ -66,39 +58,10 @@ export interface CatalogEntityDocument extends IndexableDocument { type: string; } -// @alpha -export type CatalogEntityPermission = ResourcePermission< - typeof RESOURCE_TYPE_CATALOG_ENTITY ->; - -// @alpha -export const catalogEntityReadPermission: ResourcePermission<'catalog-entity'>; - -// @alpha -export const catalogEntityRefreshPermission: ResourcePermission<'catalog-entity'>; - -// @alpha -export const catalogLocationCreatePermission: BasicPermission; - -// @alpha -export const catalogLocationDeletePermission: BasicPermission; - -// @alpha -export const catalogLocationReadPermission: BasicPermission; - -// @alpha -export const catalogPermissions: ( - | BasicPermission - | ResourcePermission<'catalog-entity'> -)[]; - // @public export type LocationSpec = { type: string; target: string; presence?: 'optional' | 'required'; }; - -// @alpha -export const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity'; ``` diff --git a/plugins/catalog-common/package.json b/plugins/catalog-common/package.json index 0ffaf3cff7..27b31d15ea 100644 --- a/plugins/catalog-common/package.json +++ b/plugins/catalog-common/package.json @@ -6,11 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "common-library" @@ -25,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -41,7 +52,6 @@ "@backstage/cli": "workspace:^" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/plugins/catalog-common/src/alpha.ts b/plugins/catalog-common/src/alpha.ts new file mode 100644 index 0000000000..2dfc028332 --- /dev/null +++ b/plugins/catalog-common/src/alpha.ts @@ -0,0 +1,28 @@ +/* + * 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 { + RESOURCE_TYPE_CATALOG_ENTITY, + catalogEntityReadPermission, + catalogEntityCreatePermission, + catalogEntityDeletePermission, + catalogEntityRefreshPermission, + catalogLocationReadPermission, + catalogLocationCreatePermission, + catalogLocationDeletePermission, + catalogPermissions, +} from './permissions'; +export type { CatalogEntityPermission } from './permissions'; diff --git a/plugins/catalog-common/src/index.ts b/plugins/catalog-common/src/index.ts index 95bd65bc92..52860a0e66 100644 --- a/plugins/catalog-common/src/index.ts +++ b/plugins/catalog-common/src/index.ts @@ -21,19 +21,6 @@ * @packageDocumentation */ -export { - RESOURCE_TYPE_CATALOG_ENTITY, - catalogEntityReadPermission, - catalogEntityCreatePermission, - catalogEntityDeletePermission, - catalogEntityRefreshPermission, - catalogLocationReadPermission, - catalogLocationCreatePermission, - catalogLocationDeletePermission, - catalogPermissions, -} from './permissions'; -export type { CatalogEntityPermission } from './permissions'; - export * from './search'; export * from './ingestion'; export type { LocationSpec } from './common'; diff --git a/plugins/catalog-node/alpha-api-report.md b/plugins/catalog-node/alpha-api-report.md new file mode 100644 index 0000000000..ba1bcd47b2 --- /dev/null +++ b/plugins/catalog-node/alpha-api-report.md @@ -0,0 +1,31 @@ +## API Report File for "@backstage/plugin-catalog-node" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { CatalogApi } from '@backstage/catalog-client'; +import { CatalogProcessor } from '@backstage/plugin-catalog-node'; +import { EntityProvider } from '@backstage/plugin-catalog-node'; +import { ExtensionPoint } from '@backstage/backend-plugin-api'; +import { ServiceRef } from '@backstage/backend-plugin-api'; + +// @alpha (undocumented) +export interface CatalogProcessingExtensionPoint { + // (undocumented) + addEntityProvider( + ...providers: Array> + ): void; + // (undocumented) + addProcessor( + ...processors: Array> + ): void; +} + +// @alpha (undocumented) +export const catalogProcessingExtensionPoint: ExtensionPoint; + +// @alpha +export const catalogServiceRef: ServiceRef; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-node/api-report.md b/plugins/catalog-node/api-report.md index 9e9045db84..87da0b6944 100644 --- a/plugins/catalog-node/api-report.md +++ b/plugins/catalog-node/api-report.md @@ -5,28 +5,10 @@ ```ts /// -import { CatalogApi } from '@backstage/catalog-client'; import { CompoundEntityRef } from '@backstage/catalog-model'; import { Entity } from '@backstage/catalog-model'; -import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { JsonValue } from '@backstage/types'; import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common'; -import { ServiceRef } from '@backstage/backend-plugin-api'; - -// @alpha (undocumented) -export interface CatalogProcessingExtensionPoint { - // (undocumented) - addEntityProvider( - ...providers: Array> - ): void; - // (undocumented) - addProcessor( - ...processors: Array> - ): void; -} - -// @alpha (undocumented) -export const catalogProcessingExtensionPoint: ExtensionPoint; // @public (undocumented) export type CatalogProcessor = { @@ -109,9 +91,6 @@ export type CatalogProcessorResult = | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult; -// @alpha -export const catalogServiceRef: ServiceRef; - // @public export type DeferredEntity = { entity: Entity; diff --git a/plugins/catalog-node/package.json b/plugins/catalog-node/package.json index 248b808645..6c888f342e 100644 --- a/plugins/catalog-node/package.json +++ b/plugins/catalog-node/package.json @@ -6,17 +6,29 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "node-library" }, "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", @@ -37,7 +49,6 @@ "@backstage/cli": "workspace:^" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/plugins/catalog-node/src/alpha.ts b/plugins/catalog-node/src/alpha.ts new file mode 100644 index 0000000000..4fb07bbc25 --- /dev/null +++ b/plugins/catalog-node/src/alpha.ts @@ -0,0 +1,19 @@ +/* + * 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 { catalogServiceRef } from './catalogService'; +export type { CatalogProcessingExtensionPoint } from './extensions'; +export { catalogProcessingExtensionPoint } from './extensions'; diff --git a/plugins/catalog-node/src/extensions.ts b/plugins/catalog-node/src/extensions.ts index 8dd9d8579a..0466af36b0 100644 --- a/plugins/catalog-node/src/extensions.ts +++ b/plugins/catalog-node/src/extensions.ts @@ -14,8 +14,10 @@ * limitations under the License. */ import { createExtensionPoint } from '@backstage/backend-plugin-api'; -import { EntityProvider } from './api'; -import { CatalogProcessor } from './api/processor'; +import { + EntityProvider, + CatalogProcessor, +} from '@backstage/plugin-catalog-node'; /** * @alpha diff --git a/plugins/catalog-node/src/index.ts b/plugins/catalog-node/src/index.ts index 6393c55f31..6a1accfcbd 100644 --- a/plugins/catalog-node/src/index.ts +++ b/plugins/catalog-node/src/index.ts @@ -20,8 +20,5 @@ * @packageDocumentation */ -export type { CatalogProcessingExtensionPoint } from './extensions'; -export { catalogProcessingExtensionPoint } from './extensions'; -export { catalogServiceRef } from './catalogService'; export * from './api'; export * from './processing'; diff --git a/plugins/catalog-react/alpha-api-report.md b/plugins/catalog-react/alpha-api-report.md new file mode 100644 index 0000000000..f9b740c07c --- /dev/null +++ b/plugins/catalog-react/alpha-api-report.md @@ -0,0 +1,22 @@ +## API Report File for "@backstage/plugin-catalog-react" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { Entity } from '@backstage/catalog-model'; +import { ResourcePermission } from '@backstage/plugin-permission-common'; + +// @alpha +export function isOwnerOf(owner: Entity, entity: Entity): boolean; + +// @alpha +export function useEntityPermission( + permission: ResourcePermission<'catalog-entity'>, +): { + loading: boolean; + allowed: boolean; + error?: Error; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 4756432857..55c72122f5 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -20,7 +20,6 @@ import { Overrides } from '@material-ui/core/styles/overrides'; import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; -import { ResourcePermission } from '@backstage/plugin-permission-common'; import { RouteRef } from '@backstage/core-plugin-api'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { StyleRules } from '@material-ui/core/styles/withStyles'; @@ -474,9 +473,6 @@ export function InspectEntityDialog(props: { onClose: () => void; }): JSX.Element | null; -// @alpha -export function isOwnerOf(owner: Entity, entity: Entity): boolean; - // @public (undocumented) export function MockEntityListContextProvider< T extends DefaultEntityFilters = DefaultEntityFilters, @@ -538,15 +534,6 @@ export function useEntityOwnership(): { isOwnedEntity: (entity: Entity) => boolean; }; -// @alpha -export function useEntityPermission( - permission: ResourcePermission<'catalog-entity'>, -): { - loading: boolean; - allowed: boolean; - error?: Error; -}; - // @public export function useEntityTypeFilter(): { loading: boolean; diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index e66c2b4bb1..e8f796a725 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "web-library" @@ -24,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -78,7 +90,6 @@ "react-test-renderer": "^16.13.1" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/plugins/catalog-react/src/alpha.ts b/plugins/catalog-react/src/alpha.ts new file mode 100644 index 0000000000..e8ff21609e --- /dev/null +++ b/plugins/catalog-react/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 { isOwnerOf } from './utils'; +export { useEntityPermission } from './hooks/useEntityPermission'; diff --git a/plugins/catalog-react/src/components/InspectEntityDialog/components/OverviewPage.tsx b/plugins/catalog-react/src/components/InspectEntityDialog/components/OverviewPage.tsx index f0adb878d6..09b944605f 100644 --- a/plugins/catalog-react/src/components/InspectEntityDialog/components/OverviewPage.tsx +++ b/plugins/catalog-react/src/components/InspectEntityDialog/components/OverviewPage.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { AlphaEntity } from '@backstage/catalog-model'; +import { AlphaEntity } from '@backstage/catalog-model/alpha'; import { Box, DialogContentText, diff --git a/plugins/catalog-react/src/filters.test.ts b/plugins/catalog-react/src/filters.test.ts index c2c92e033e..2a67190633 100644 --- a/plugins/catalog-react/src/filters.test.ts +++ b/plugins/catalog-react/src/filters.test.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { AlphaEntity, Entity } from '@backstage/catalog-model'; +import { AlphaEntity } from '@backstage/catalog-model/alpha'; +import { Entity } from '@backstage/catalog-model'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { EntityErrorFilter, diff --git a/plugins/catalog-react/src/filters.ts b/plugins/catalog-react/src/filters.ts index 056b3b92c1..5bd81780d6 100644 --- a/plugins/catalog-react/src/filters.ts +++ b/plugins/catalog-react/src/filters.ts @@ -14,11 +14,8 @@ * limitations under the License. */ -import { - AlphaEntity, - Entity, - RELATION_OWNED_BY, -} from '@backstage/catalog-model'; +import { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model'; +import { AlphaEntity } from '@backstage/catalog-model/alpha'; import { humanizeEntityRef } from './components/EntityRefLink'; import { EntityFilter, UserListFilterKind } from './types'; import { getEntityRelations } from './utils'; diff --git a/plugins/catalog-react/src/hooks/index.ts b/plugins/catalog-react/src/hooks/index.ts index 3570ed897c..ffd32206ef 100644 --- a/plugins/catalog-react/src/hooks/index.ts +++ b/plugins/catalog-react/src/hooks/index.ts @@ -38,4 +38,3 @@ export { useRelatedEntities } from './useRelatedEntities'; export { useStarredEntities } from './useStarredEntities'; export { useStarredEntity } from './useStarredEntity'; export { useEntityOwnership } from './useEntityOwnership'; -export { useEntityPermission } from './useEntityPermission'; diff --git a/plugins/catalog-react/src/hooks/useEntityPermission.test.tsx b/plugins/catalog-react/src/hooks/useEntityPermission.test.tsx index 766b587da3..aed6676838 100644 --- a/plugins/catalog-react/src/hooks/useEntityPermission.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityPermission.test.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha'; import { renderHook } from '@testing-library/react-hooks'; import { useEntityPermission } from './useEntityPermission'; import { useAsyncEntity } from './useEntity'; diff --git a/plugins/catalog-react/src/index.ts b/plugins/catalog-react/src/index.ts index 2ca7d67d59..b511116f84 100644 --- a/plugins/catalog-react/src/index.ts +++ b/plugins/catalog-react/src/index.ts @@ -31,9 +31,5 @@ export { entityRouteParams, entityRouteRef } from './routes'; export * from './testUtils'; export * from './types'; export * from './overridableComponents'; -export { - getEntityRelations, - getEntitySourceLocation, - isOwnerOf, -} from './utils'; +export { getEntityRelations, getEntitySourceLocation } from './utils'; export type { EntitySourceLocation } from './utils'; diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx index 10f06ca09e..7b92df5809 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx @@ -34,9 +34,9 @@ import { MockStarredEntitiesApi, starredEntitiesApiRef, } from '@backstage/plugin-catalog-react'; +import { MockPluginProvider } from '@backstage/test-utils/alpha'; import { mockBreakpoint, - MockPluginProvider, MockStorageApi, renderWithEffects, TestApiProvider, diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx index d22f9bde10..675f74fa8d 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.tsx @@ -30,8 +30,8 @@ import MoreVert from '@material-ui/icons/MoreVert'; import FileCopyTwoToneIcon from '@material-ui/icons/FileCopyTwoTone'; import React, { useCallback, useState } from 'react'; import { IconComponent } from '@backstage/core-plugin-api'; -import { useEntityPermission } from '@backstage/plugin-catalog-react'; -import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common'; +import { useEntityPermission } from '@backstage/plugin-catalog-react/alpha'; +import { catalogEntityDeletePermission } from '@backstage/plugin-catalog-common/alpha'; import { BackstageTheme } from '@backstage/theme'; import { UnregisterEntity, UnregisterEntityOptions } from './UnregisterEntity'; import { useApi, alertApiRef } from '@backstage/core-plugin-api'; diff --git a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.test.tsx b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.test.tsx index 350349fe95..b21c6292ff 100644 --- a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.test.tsx +++ b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.test.tsx @@ -14,7 +14,8 @@ * limitations under the License. */ -import { AlphaEntity, stringifyEntityRef } from '@backstage/catalog-model'; +import { AlphaEntity } from '@backstage/catalog-model/alpha'; +import { stringifyEntityRef } from '@backstage/catalog-model'; import { ApiProvider } from '@backstage/core-app-api'; import { CatalogApi, diff --git a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx index 2eaf505ec0..ef91e7b26e 100644 --- a/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx +++ b/plugins/catalog/src/components/EntityProcessingErrorsPanel/EntityProcessingErrorsPanel.tsx @@ -14,12 +14,8 @@ * limitations under the License. */ -import { - Entity, - AlphaEntity, - stringifyEntityRef, - EntityStatusItem, -} from '@backstage/catalog-model'; +import { AlphaEntity, EntityStatusItem } from '@backstage/catalog-model/alpha'; +import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; import { catalogApiRef, EntityRefLink, diff --git a/plugins/catalog/src/options.ts b/plugins/catalog/src/options.ts index bb248c16b6..4ea6449a4b 100644 --- a/plugins/catalog/src/options.ts +++ b/plugins/catalog/src/options.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { usePluginOptions } from '@backstage/core-plugin-api'; +import { usePluginOptions } from '@backstage/core-plugin-api/alpha'; export type CatalogPluginOptions = { createButtonTitle: string; diff --git a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx index 0a9451c794..d4fdc66bdb 100644 --- a/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx +++ b/plugins/cost-insights/src/components/CostOverviewCard/CostOverviewCard.test.tsx @@ -15,7 +15,8 @@ */ import React from 'react'; import { fireEvent } from '@testing-library/react'; -import { MockPluginProvider, renderInTestApp } from '@backstage/test-utils'; +import { MockPluginProvider } from '@backstage/test-utils/alpha'; +import { renderInTestApp } from '@backstage/test-utils'; import { CostOverviewCard } from './CostOverviewCard'; import { Cost } from '@backstage/plugin-cost-insights-common'; import { diff --git a/plugins/cost-insights/src/components/EntityCosts/EntityCost.test.tsx b/plugins/cost-insights/src/components/EntityCosts/EntityCost.test.tsx index f288f54e9b..6eb3369b40 100644 --- a/plugins/cost-insights/src/components/EntityCosts/EntityCost.test.tsx +++ b/plugins/cost-insights/src/components/EntityCosts/EntityCost.test.tsx @@ -14,11 +14,8 @@ * limitations under the License. */ import React from 'react'; -import { - MockPluginProvider, - renderInTestApp, - TestApiProvider, -} from '@backstage/test-utils'; +import { MockPluginProvider } from '@backstage/test-utils/alpha'; +import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import { changeOf, MockAggregatedDailyCosts, diff --git a/plugins/cost-insights/src/options.ts b/plugins/cost-insights/src/options.ts index 287935d703..acc977771d 100644 --- a/plugins/cost-insights/src/options.ts +++ b/plugins/cost-insights/src/options.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { usePluginOptions } from '@backstage/core-plugin-api'; +import { usePluginOptions } from '@backstage/core-plugin-api/alpha'; export type CostInsightsPluginOptions = { hideTrendLine?: boolean; diff --git a/plugins/events-backend-module-aws-sqs/alpha-api-report.md b/plugins/events-backend-module-aws-sqs/alpha-api-report.md new file mode 100644 index 0000000000..b9f60c4437 --- /dev/null +++ b/plugins/events-backend-module-aws-sqs/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-events-backend-module-aws-sqs" + +> 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'; + +// @alpha +export const awsSqsConsumingEventPublisherEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-aws-sqs/api-report.md b/plugins/events-backend-module-aws-sqs/api-report.md index ede18f2787..ffa9c888d6 100644 --- a/plugins/events-backend-module-aws-sqs/api-report.md +++ b/plugins/events-backend-module-aws-sqs/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 { EventBroker } from '@backstage/plugin-events-node'; import { EventPublisher } from '@backstage/plugin-events-node'; @@ -21,7 +20,4 @@ export class AwsSqsConsumingEventPublisher implements EventPublisher { // (undocumented) setEventBroker(eventBroker: EventBroker): Promise; } - -// @alpha -export const awsSqsConsumingEventPublisherEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-aws-sqs/package.json b/plugins/events-backend-module-aws-sqs/package.json index a4ec624c91..2e45015bce 100644 --- a/plugins/events-backend-module-aws-sqs/package.json +++ b/plugins/events-backend-module-aws-sqs/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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", @@ -42,7 +54,6 @@ "aws-sdk-client-mock": "^2.0.0" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/events-backend-module-aws-sqs/src/alpha.ts b/plugins/events-backend-module-aws-sqs/src/alpha.ts new file mode 100644 index 0000000000..00f08e4417 --- /dev/null +++ b/plugins/events-backend-module-aws-sqs/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { awsSqsConsumingEventPublisherEventsModule } from './service/AwsSqsConsumingEventPublisherEventsModule'; diff --git a/plugins/events-backend-module-aws-sqs/src/index.ts b/plugins/events-backend-module-aws-sqs/src/index.ts index 73b950856b..57f409c044 100644 --- a/plugins/events-backend-module-aws-sqs/src/index.ts +++ b/plugins/events-backend-module-aws-sqs/src/index.ts @@ -24,4 +24,3 @@ */ export { AwsSqsConsumingEventPublisher } from './publisher/AwsSqsConsumingEventPublisher'; -export { awsSqsConsumingEventPublisherEventsModule } from './service/AwsSqsConsumingEventPublisherEventsModule'; diff --git a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.test.ts b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.test.ts index 589b8c93fa..3963b9a8b6 100644 --- a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.test.ts +++ b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.test.ts @@ -18,7 +18,7 @@ import { getVoidLogger } from '@backstage/backend-common'; 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'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { TestEventBroker } from '@backstage/plugin-events-backend-test-utils'; import { awsSqsConsumingEventPublisherEventsModule } from './AwsSqsConsumingEventPublisherEventsModule'; import { AwsSqsConsumingEventPublisher } from '../publisher/AwsSqsConsumingEventPublisher'; diff --git a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts index 50812f321b..4205bd231b 100644 --- a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts +++ b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts @@ -19,7 +19,7 @@ import { createBackendModule, } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { AwsSqsConsumingEventPublisher } from '../publisher/AwsSqsConsumingEventPublisher'; /** diff --git a/plugins/events-backend-module-azure/alpha-api-report.md b/plugins/events-backend-module-azure/alpha-api-report.md new file mode 100644 index 0000000000..e3fed2cab0 --- /dev/null +++ b/plugins/events-backend-module-azure/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-events-backend-module-azure" + +> 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'; + +// @alpha +export const azureDevOpsEventRouterEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-azure/api-report.md b/plugins/events-backend-module-azure/api-report.md index 2e13a7ed4a..4460aeb510 100644 --- a/plugins/events-backend-module-azure/api-report.md +++ b/plugins/events-backend-module-azure/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 { EventParams } from '@backstage/plugin-events-node'; import { SubTopicEventRouter } from '@backstage/plugin-events-node'; @@ -13,7 +12,4 @@ export class AzureDevOpsEventRouter extends SubTopicEventRouter { // (undocumented) protected determineSubTopic(params: EventParams): string | undefined; } - -// @alpha -export const azureDevOpsEventRouterEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-azure/package.json b/plugins/events-backend-module-azure/package.json index 88c2dcc795..a3acd37263 100644 --- a/plugins/events-backend-module-azure/package.json +++ b/plugins/events-backend-module-azure/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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", @@ -34,7 +46,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "dist" ] } diff --git a/plugins/events-backend-module-azure/src/alpha.ts b/plugins/events-backend-module-azure/src/alpha.ts new file mode 100644 index 0000000000..8eacbd8270 --- /dev/null +++ b/plugins/events-backend-module-azure/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { azureDevOpsEventRouterEventsModule } from './service/AzureDevOpsEventRouterEventsModule'; diff --git a/plugins/events-backend-module-azure/src/index.ts b/plugins/events-backend-module-azure/src/index.ts index 9a83f751f6..a1d56dc536 100644 --- a/plugins/events-backend-module-azure/src/index.ts +++ b/plugins/events-backend-module-azure/src/index.ts @@ -22,4 +22,3 @@ */ export { AzureDevOpsEventRouter } from './router/AzureDevOpsEventRouter'; -export { azureDevOpsEventRouterEventsModule } from './service/AzureDevOpsEventRouterEventsModule'; diff --git a/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.test.ts b/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.test.ts index 86ab7ea17d..dbd61782ae 100644 --- a/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.test.ts +++ b/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.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 { azureDevOpsEventRouterEventsModule } from './AzureDevOpsEventRouterEventsModule'; import { AzureDevOpsEventRouter } from '../router/AzureDevOpsEventRouter'; diff --git a/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.ts b/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.ts index 1219452bd8..18851befa4 100644 --- a/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.ts +++ b/plugins/events-backend-module-azure/src/service/AzureDevOpsEventRouterEventsModule.ts @@ -15,13 +15,13 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { AzureDevOpsEventRouter } from '../router/AzureDevOpsEventRouter'; /** * Module for the events-backend plugin, adding an event router for Azure DevOps. * - * Registers the {@link AzureDevOpsEventRouter}. + * Registers the `AzureDevOpsEventRouter`. * * @alpha */ diff --git a/plugins/events-backend-module-bitbucket-cloud/alpha-api-report.md b/plugins/events-backend-module-bitbucket-cloud/alpha-api-report.md new file mode 100644 index 0000000000..f8e550bf98 --- /dev/null +++ b/plugins/events-backend-module-bitbucket-cloud/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-events-backend-module-bitbucket-cloud" + +> 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'; + +// @alpha +export const bitbucketCloudEventRouterEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-bitbucket-cloud/api-report.md b/plugins/events-backend-module-bitbucket-cloud/api-report.md index c47252ce17..4795edd89a 100644 --- a/plugins/events-backend-module-bitbucket-cloud/api-report.md +++ b/plugins/events-backend-module-bitbucket-cloud/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 { EventParams } from '@backstage/plugin-events-node'; import { SubTopicEventRouter } from '@backstage/plugin-events-node'; @@ -13,7 +12,4 @@ export class BitbucketCloudEventRouter extends SubTopicEventRouter { // (undocumented) protected determineSubTopic(params: EventParams): string | undefined; } - -// @alpha -export const bitbucketCloudEventRouterEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-bitbucket-cloud/package.json b/plugins/events-backend-module-bitbucket-cloud/package.json index 9fc879cfec..ae006b1bce 100644 --- a/plugins/events-backend-module-bitbucket-cloud/package.json +++ b/plugins/events-backend-module-bitbucket-cloud/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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", @@ -34,7 +46,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "dist" ] } diff --git a/plugins/events-backend-module-bitbucket-cloud/src/alpha.ts b/plugins/events-backend-module-bitbucket-cloud/src/alpha.ts new file mode 100644 index 0000000000..e19ff9c9b5 --- /dev/null +++ b/plugins/events-backend-module-bitbucket-cloud/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { bitbucketCloudEventRouterEventsModule } from './service/BitbucketCloudEventRouterEventsModule'; diff --git a/plugins/events-backend-module-bitbucket-cloud/src/index.ts b/plugins/events-backend-module-bitbucket-cloud/src/index.ts index 0a58212de2..77aa9798ef 100644 --- a/plugins/events-backend-module-bitbucket-cloud/src/index.ts +++ b/plugins/events-backend-module-bitbucket-cloud/src/index.ts @@ -22,4 +22,3 @@ */ export { BitbucketCloudEventRouter } from './router/BitbucketCloudEventRouter'; -export { bitbucketCloudEventRouterEventsModule } from './service/BitbucketCloudEventRouterEventsModule'; diff --git a/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.test.ts b/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.test.ts index e456607a2b..60ce5b713e 100644 --- a/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.test.ts +++ b/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.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 { bitbucketCloudEventRouterEventsModule } from './BitbucketCloudEventRouterEventsModule'; import { BitbucketCloudEventRouter } from '../router/BitbucketCloudEventRouter'; diff --git a/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.ts b/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.ts index 7f755a28f4..9516651aa3 100644 --- a/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.ts +++ b/plugins/events-backend-module-bitbucket-cloud/src/service/BitbucketCloudEventRouterEventsModule.ts @@ -15,13 +15,13 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { BitbucketCloudEventRouter } from '../router/BitbucketCloudEventRouter'; /** * Module for the events-backend plugin, adding an event router for Bitbucket Cloud. * - * Registers the {@link BitbucketCloudEventRouter}. + * Registers the `BitbucketCloudEventRouter`. * * @alpha */ diff --git a/plugins/events-backend-module-gerrit/alpha-api-report.md b/plugins/events-backend-module-gerrit/alpha-api-report.md new file mode 100644 index 0000000000..f610d518e7 --- /dev/null +++ b/plugins/events-backend-module-gerrit/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-events-backend-module-gerrit" + +> 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'; + +// @alpha +export const gerritEventRouterEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-gerrit/api-report.md b/plugins/events-backend-module-gerrit/api-report.md index c8d4a7c9b6..ba3c4dd29f 100644 --- a/plugins/events-backend-module-gerrit/api-report.md +++ b/plugins/events-backend-module-gerrit/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 { EventParams } from '@backstage/plugin-events-node'; import { SubTopicEventRouter } from '@backstage/plugin-events-node'; @@ -13,7 +12,4 @@ export class GerritEventRouter extends SubTopicEventRouter { // (undocumented) protected determineSubTopic(params: EventParams): string | undefined; } - -// @alpha -export const gerritEventRouterEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-gerrit/package.json b/plugins/events-backend-module-gerrit/package.json index 85e9ac92dc..a7aadf06dc 100644 --- a/plugins/events-backend-module-gerrit/package.json +++ b/plugins/events-backend-module-gerrit/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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", @@ -34,7 +46,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "dist" ] } diff --git a/plugins/events-backend-module-gerrit/src/alpha.ts b/plugins/events-backend-module-gerrit/src/alpha.ts new file mode 100644 index 0000000000..26fd89b14d --- /dev/null +++ b/plugins/events-backend-module-gerrit/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { gerritEventRouterEventsModule } from './service/GerritEventRouterEventsModule'; diff --git a/plugins/events-backend-module-gerrit/src/index.ts b/plugins/events-backend-module-gerrit/src/index.ts index 1a9ebb03ee..dfc314667f 100644 --- a/plugins/events-backend-module-gerrit/src/index.ts +++ b/plugins/events-backend-module-gerrit/src/index.ts @@ -22,4 +22,3 @@ */ export { GerritEventRouter } from './router/GerritEventRouter'; -export { gerritEventRouterEventsModule } from './service/GerritEventRouterEventsModule'; diff --git a/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.test.ts b/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.test.ts index b5fd6a80ca..6a8f4f46ff 100644 --- a/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.test.ts +++ b/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.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 { gerritEventRouterEventsModule } from './GerritEventRouterEventsModule'; import { GerritEventRouter } from '../router/GerritEventRouter'; diff --git a/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.ts b/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.ts index 734b574edd..31f5c9b384 100644 --- a/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.ts +++ b/plugins/events-backend-module-gerrit/src/service/GerritEventRouterEventsModule.ts @@ -15,13 +15,13 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { GerritEventRouter } from '../router/GerritEventRouter'; /** * Module for the events-backend plugin, adding an event router for Gerrit. * - * Registers the {@link GerritEventRouter}. + * Registers the `GerritEventRouter`. * * @alpha */ 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..cb95928b17 --- /dev/null +++ b/plugins/events-backend-module-github/alpha-api-report.md @@ -0,0 +1,15 @@ +## 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'; + +// @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..966b7b3592 100644 --- a/plugins/events-backend-module-github/package.json +++ b/plugins/events-backend-module-github/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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 +48,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..56cc571763 100644 --- a/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts +++ b/plugins/events-backend-module-github/src/service/GithubEventRouterEventsModule.ts @@ -15,13 +15,13 @@ */ 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'; /** * Module for the events-backend plugin, adding an event router for GitHub. * - * Registers the {@link GithubEventRouter}. + * Registers the `GithubEventRouter`. * * @alpha */ 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'; /** diff --git a/plugins/events-backend-module-gitlab/alpha-api-report.md b/plugins/events-backend-module-gitlab/alpha-api-report.md new file mode 100644 index 0000000000..64727cc844 --- /dev/null +++ b/plugins/events-backend-module-gitlab/alpha-api-report.md @@ -0,0 +1,15 @@ +## API Report File for "@backstage/plugin-events-backend-module-gitlab" + +> 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'; + +// @alpha +export const gitlabEventRouterEventsModule: () => BackendFeature; + +// @alpha +export const gitlabWebhookEventsModule: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend-module-gitlab/api-report.md b/plugins/events-backend-module-gitlab/api-report.md index 2a88295032..8a0c513857 100644 --- a/plugins/events-backend-module-gitlab/api-report.md +++ b/plugins/events-backend-module-gitlab/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'; @@ -18,10 +17,4 @@ export class GitlabEventRouter extends SubTopicEventRouter { // (undocumented) protected determineSubTopic(params: EventParams): string | undefined; } - -// @alpha -export const gitlabEventRouterEventsModule: () => BackendFeature; - -// @alpha -export const gitlabWebhookEventsModule: () => BackendFeature; ``` diff --git a/plugins/events-backend-module-gitlab/package.json b/plugins/events-backend-module-gitlab/package.json index 7e195bc447..4e5e53771d 100644 --- a/plugins/events-backend-module-gitlab/package.json +++ b/plugins/events-backend-module-gitlab/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "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", @@ -35,7 +47,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/events-backend-module-gitlab/src/alpha.ts b/plugins/events-backend-module-gitlab/src/alpha.ts new file mode 100644 index 0000000000..357c9f81ce --- /dev/null +++ b/plugins/events-backend-module-gitlab/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 { gitlabEventRouterEventsModule } from './service/GitlabEventRouterEventsModule'; +export { gitlabWebhookEventsModule } from './service/GitlabWebhookEventsModule'; diff --git a/plugins/events-backend-module-gitlab/src/index.ts b/plugins/events-backend-module-gitlab/src/index.ts index 859a6c69c0..3788e02955 100644 --- a/plugins/events-backend-module-gitlab/src/index.ts +++ b/plugins/events-backend-module-gitlab/src/index.ts @@ -23,5 +23,3 @@ export { createGitlabTokenValidator } from './http/createGitlabTokenValidator'; export { GitlabEventRouter } from './router/GitlabEventRouter'; -export { gitlabEventRouterEventsModule } from './service/GitlabEventRouterEventsModule'; -export { gitlabWebhookEventsModule } from './service/GitlabWebhookEventsModule'; diff --git a/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.test.ts b/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.test.ts index f0ffca3397..f8b03bc0f3 100644 --- a/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.test.ts +++ b/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.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 { gitlabEventRouterEventsModule } from './GitlabEventRouterEventsModule'; import { GitlabEventRouter } from '../router/GitlabEventRouter'; diff --git a/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.ts b/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.ts index 9ab2e1263e..39ccd5cd60 100644 --- a/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.ts +++ b/plugins/events-backend-module-gitlab/src/service/GitlabEventRouterEventsModule.ts @@ -15,13 +15,13 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { GitlabEventRouter } from '../router/GitlabEventRouter'; /** * Module for the events-backend plugin, adding an event router for GitLab. * - * Registers the {@link GitlabEventRouter}. + * Registers the `GitlabEventRouter`. * * @alpha */ diff --git a/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.test.ts b/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.test.ts index b139f46f55..b42f2c474e 100644 --- a/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.test.ts +++ b/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.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-gitlab/src/service/GitlabWebhookEventsModule.ts b/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.ts index 44f13f31ef..c20e55caa9 100644 --- a/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.ts +++ b/plugins/events-backend-module-gitlab/src/service/GitlabWebhookEventsModule.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 { createGitlabTokenValidator } from '../http/createGitlabTokenValidator'; /** @@ -26,7 +26,7 @@ import { createGitlabTokenValidator } from '../http/createGitlabTokenValidator'; * registering an HTTP POST ingress with request validator * which verifies the webhook token based on a secret. * - * Registers the {@link GitlabEventRouter}. + * Registers the `GitlabEventRouter`. * * @alpha */ diff --git a/plugins/events-backend/alpha-api-report.md b/plugins/events-backend/alpha-api-report.md new file mode 100644 index 0000000000..3e32f769c1 --- /dev/null +++ b/plugins/events-backend/alpha-api-report.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-events-backend" + +> 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'; + +// @alpha +export const eventsPlugin: () => BackendFeature; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-backend/api-report.md b/plugins/events-backend/api-report.md index 28437772ae..7d8ede1979 100644 --- a/plugins/events-backend/api-report.md +++ b/plugins/events-backend/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 { EventBroker } from '@backstage/plugin-events-node'; import { EventPublisher } from '@backstage/plugin-events-node'; @@ -28,9 +27,6 @@ export class EventsBackend { start(): Promise; } -// @alpha -export const eventsPlugin: () => BackendFeature; - // @public export class HttpPostIngressEventPublisher implements EventPublisher { // (undocumented) diff --git a/plugins/events-backend/package.json b/plugins/events-backend/package.json index fce00f668c..d779869e14 100644 --- a/plugins/events-backend/package.json +++ b/plugins/events-backend/package.json @@ -5,17 +5,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin" }, "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", @@ -40,7 +52,6 @@ "supertest": "^6.1.3" }, "files": [ - "alpha", "config.d.ts", "dist" ], diff --git a/plugins/events-backend/src/alpha.ts b/plugins/events-backend/src/alpha.ts new file mode 100644 index 0000000000..4403da1636 --- /dev/null +++ b/plugins/events-backend/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * 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 { eventsPlugin } from './service/EventsPlugin'; diff --git a/plugins/events-backend/src/index.ts b/plugins/events-backend/src/index.ts index 5026729015..4645e9a479 100644 --- a/plugins/events-backend/src/index.ts +++ b/plugins/events-backend/src/index.ts @@ -21,5 +21,4 @@ */ export { EventsBackend } from './service/EventsBackend'; -export { eventsPlugin } from './service/EventsPlugin'; export { HttpPostIngressEventPublisher } from './service/http'; diff --git a/plugins/events-backend/src/service/EventsPlugin.test.ts b/plugins/events-backend/src/service/EventsPlugin.test.ts index 0570b16d01..73578ae222 100644 --- a/plugins/events-backend/src/service/EventsPlugin.test.ts +++ b/plugins/events-backend/src/service/EventsPlugin.test.ts @@ -21,7 +21,7 @@ import { createBackendModule, } from '@backstage/backend-plugin-api'; import { startTestBackend } from '@backstage/backend-test-utils'; -import { eventsExtensionPoint } from '@backstage/plugin-events-node'; +import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha'; import { TestEventBroker, TestEventPublisher, diff --git a/plugins/events-backend/src/service/EventsPlugin.ts b/plugins/events-backend/src/service/EventsPlugin.ts index 402104b56c..1ae038a2ac 100644 --- a/plugins/events-backend/src/service/EventsPlugin.ts +++ b/plugins/events-backend/src/service/EventsPlugin.ts @@ -19,12 +19,14 @@ import { coreServices, } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; +import { + eventsExtensionPoint, + EventsExtensionPoint, +} from '@backstage/plugin-events-node/alpha'; import { EventBroker, EventPublisher, EventSubscriber, - eventsExtensionPoint, - EventsExtensionPoint, HttpPostIngressOptions, } from '@backstage/plugin-events-node'; import { InMemoryEventBroker } from './InMemoryEventBroker'; diff --git a/plugins/events-node/alpha-api-report.md b/plugins/events-node/alpha-api-report.md new file mode 100644 index 0000000000..fd30f54d45 --- /dev/null +++ b/plugins/events-node/alpha-api-report.md @@ -0,0 +1,32 @@ +## API Report File for "@backstage/plugin-events-node" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { EventBroker } from '@backstage/plugin-events-node'; +import { EventPublisher } from '@backstage/plugin-events-node'; +import { EventSubscriber } from '@backstage/plugin-events-node'; +import { ExtensionPoint } from '@backstage/backend-plugin-api'; +import { HttpPostIngressOptions } from '@backstage/plugin-events-node'; + +// @alpha (undocumented) +export interface EventsExtensionPoint { + // (undocumented) + addHttpPostIngress(options: HttpPostIngressOptions): void; + // (undocumented) + addPublishers( + ...publishers: Array> + ): void; + // (undocumented) + addSubscribers( + ...subscribers: Array> + ): void; + // (undocumented) + setEventBroker(eventBroker: EventBroker): void; +} + +// @alpha (undocumented) +export const eventsExtensionPoint: ExtensionPoint; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/events-node/api-report.md b/plugins/events-node/api-report.md index 8428003b85..dfda48d97e 100644 --- a/plugins/events-node/api-report.md +++ b/plugins/events-node/api-report.md @@ -3,8 +3,6 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { ExtensionPoint } from '@backstage/backend-plugin-api'; - // @public export interface EventBroker { publish(params: EventParams): Promise; @@ -40,25 +38,6 @@ export abstract class EventRouter implements EventPublisher, EventSubscriber { abstract supportsEventTopics(): string[]; } -// @alpha (undocumented) -export interface EventsExtensionPoint { - // (undocumented) - addHttpPostIngress(options: HttpPostIngressOptions): void; - // (undocumented) - addPublishers( - ...publishers: Array> - ): void; - // (undocumented) - addSubscribers( - ...subscribers: Array> - ): void; - // (undocumented) - setEventBroker(eventBroker: EventBroker): void; -} - -// @alpha (undocumented) -export const eventsExtensionPoint: ExtensionPoint; - // @public export interface EventSubscriber { onEvent(params: EventParams): Promise; diff --git a/plugins/events-node/package.json b/plugins/events-node/package.json index 9dffabcaac..368e567930 100644 --- a/plugins/events-node/package.json +++ b/plugins/events-node/package.json @@ -6,17 +6,29 @@ "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", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "node-library" }, "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", @@ -30,7 +42,6 @@ "@backstage/cli": "workspace:^" }, "files": [ - "alpha", "dist" ] } diff --git a/plugins/events-node/src/alpha.ts b/plugins/events-node/src/alpha.ts new file mode 100644 index 0000000000..90666ba2f3 --- /dev/null +++ b/plugins/events-node/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 type { EventsExtensionPoint } from './extensions'; +export { eventsExtensionPoint } from './extensions'; diff --git a/plugins/events-node/src/extensions.ts b/plugins/events-node/src/extensions.ts index 945d86b49c..2e44b381af 100644 --- a/plugins/events-node/src/extensions.ts +++ b/plugins/events-node/src/extensions.ts @@ -20,7 +20,7 @@ import { EventPublisher, EventSubscriber, HttpPostIngressOptions, -} from './api'; +} from '@backstage/plugin-events-node'; /** * @alpha diff --git a/plugins/events-node/src/index.ts b/plugins/events-node/src/index.ts index 422eeb169e..2bdf456f13 100644 --- a/plugins/events-node/src/index.ts +++ b/plugins/events-node/src/index.ts @@ -21,5 +21,3 @@ */ export * from './api'; -export type { EventsExtensionPoint } from './extensions'; -export { eventsExtensionPoint } from './extensions'; diff --git a/plugins/jenkins-common/src/permissions.ts b/plugins/jenkins-common/src/permissions.ts index 5ca5ec6adf..311bf993cc 100644 --- a/plugins/jenkins-common/src/permissions.ts +++ b/plugins/jenkins-common/src/permissions.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common'; +import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha'; import { createPermission } from '@backstage/plugin-permission-common'; /** diff --git a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx index 0217f00513..1bb6dbaefc 100644 --- a/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx +++ b/plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx @@ -15,7 +15,7 @@ */ import { Link, Progress, Table, TableColumn } from '@backstage/core-components'; import { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; -import { useEntityPermission } from '@backstage/plugin-catalog-react'; +import { useEntityPermission } from '@backstage/plugin-catalog-react/alpha'; import { Box, IconButton, Tooltip, Typography } from '@material-ui/core'; import RetryIcon from '@material-ui/icons/Replay'; import { default as React, useState } from 'react'; diff --git a/plugins/kubernetes-backend/api-report.md b/plugins/kubernetes-backend/api-report.md index 006f980c56..a6a4bcfc58 100644 --- a/plugins/kubernetes-backend/api-report.md +++ b/plugins/kubernetes-backend/api-report.md @@ -21,7 +21,7 @@ import { PluginEndpointDiscovery } from '@backstage/backend-common'; import type { RequestHandler } from 'express'; import { TokenCredential } from '@azure/identity'; -// @alpha (undocumented) +// @public (undocumented) export interface AWSClusterDetails extends ClusterDetails { // (undocumented) assumeRole?: string; @@ -29,7 +29,7 @@ export interface AWSClusterDetails extends ClusterDetails { externalId?: string; } -// @alpha (undocumented) +// @public (undocumented) export class AwsIamKubernetesAuthTranslator implements KubernetesAuthTranslator { @@ -54,10 +54,10 @@ export class AwsIamKubernetesAuthTranslator validCredentials(creds: SigningCreds): boolean; } -// @alpha (undocumented) +// @public (undocumented) export interface AzureClusterDetails extends ClusterDetails {} -// @alpha (undocumented) +// @public (undocumented) export class AzureIdentityKubernetesAuthTranslator implements KubernetesAuthTranslator { @@ -68,7 +68,7 @@ export class AzureIdentityKubernetesAuthTranslator ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface ClusterDetails { // (undocumented) authProvider: string; @@ -91,25 +91,25 @@ export interface ClusterDetails { url: string; } -// @alpha @deprecated +// @public @deprecated export function createRouter(options: RouterOptions): Promise; -// @alpha (undocumented) +// @public (undocumented) export interface CustomResource extends ObjectToFetch { // (undocumented) objectType: 'customresources'; } -// @alpha (undocumented) +// @public (undocumented) export interface CustomResourcesByEntity extends KubernetesObjectsByEntity { // (undocumented) customResources: CustomResourceMatcher[]; } -// @alpha (undocumented) +// @public (undocumented) export const DEFAULT_OBJECTS: ObjectToFetch[]; -// @alpha (undocumented) +// @public (undocumented) export interface FetchResponseWrapper { // (undocumented) errors: KubernetesFetchError[]; @@ -117,10 +117,10 @@ export interface FetchResponseWrapper { responses: FetchResponse[]; } -// @alpha (undocumented) +// @public (undocumented) export interface GKEClusterDetails extends ClusterDetails {} -// @alpha (undocumented) +// @public (undocumented) export class GoogleKubernetesAuthTranslator implements KubernetesAuthTranslator { @@ -131,7 +131,7 @@ export class GoogleKubernetesAuthTranslator ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export class GoogleServiceAccountAuthTranslator implements KubernetesAuthTranslator { @@ -144,7 +144,7 @@ export class GoogleServiceAccountAuthTranslator // @public export const HEADER_KUBERNETES_CLUSTER: string; -// @alpha (undocumented) +// @public (undocumented) export interface KubernetesAuthTranslator { // (undocumented) decorateClusterDetailsWithAuth( @@ -153,7 +153,7 @@ export interface KubernetesAuthTranslator { ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export class KubernetesAuthTranslatorGenerator { // (undocumented) static getKubernetesAuthTranslatorInstance( @@ -164,7 +164,7 @@ export class KubernetesAuthTranslatorGenerator { ): KubernetesAuthTranslator; } -// @alpha (undocumented) +// @public (undocumented) export class KubernetesBuilder { constructor(env: KubernetesEnvironment); // (undocumented) @@ -247,7 +247,7 @@ export class KubernetesBuilder { setServiceLocator(serviceLocator?: KubernetesServiceLocator): this; } -// @alpha +// @public export type KubernetesBuilderReturn = Promise<{ router: express.Router; clusterSupplier: KubernetesClustersSupplier; @@ -258,12 +258,12 @@ export type KubernetesBuilderReturn = Promise<{ serviceLocator: KubernetesServiceLocator; }>; -// @alpha +// @public export interface KubernetesClustersSupplier { getClusters(): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface KubernetesEnvironment { // (undocumented) catalogApi: CatalogApi; @@ -273,7 +273,7 @@ export interface KubernetesEnvironment { logger: Logger; } -// @alpha +// @public export interface KubernetesFetcher { // (undocumented) fetchObjectsForService( @@ -286,7 +286,7 @@ export interface KubernetesFetcher { ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface KubernetesObjectsByEntity { // (undocumented) auth: KubernetesRequestAuth; @@ -294,7 +294,7 @@ export interface KubernetesObjectsByEntity { entity: Entity; } -// @alpha (undocumented) +// @public (undocumented) export interface KubernetesObjectsProvider { // (undocumented) getCustomResourcesByEntity( @@ -306,7 +306,7 @@ export interface KubernetesObjectsProvider { ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface KubernetesObjectsProviderOptions { // (undocumented) customResources: CustomResource[]; @@ -320,7 +320,7 @@ export interface KubernetesObjectsProviderOptions { serviceLocator: KubernetesServiceLocator; } -// @alpha (undocumented) +// @public (undocumented) export type KubernetesObjectTypes = | 'pods' | 'services' @@ -336,14 +336,14 @@ export type KubernetesObjectTypes = | 'statefulsets' | 'daemonsets'; -// @alpha +// @public export class KubernetesProxy { constructor(logger: Logger, clusterSupplier: KubernetesClustersSupplier); // (undocumented) createRequestHandler(): RequestHandler; } -// @alpha +// @public export interface KubernetesServiceLocator { // (undocumented) getClustersByEntity( @@ -354,7 +354,7 @@ export interface KubernetesServiceLocator { }>; } -// @alpha (undocumented) +// @public (undocumented) export class NoopKubernetesAuthTranslator implements KubernetesAuthTranslator { // (undocumented) decorateClusterDetailsWithAuth( @@ -362,7 +362,7 @@ export class NoopKubernetesAuthTranslator implements KubernetesAuthTranslator { ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface ObjectFetchParams { // (undocumented) clusterDetails: @@ -382,10 +382,10 @@ export interface ObjectFetchParams { serviceId: string; } -// @alpha (undocumented) +// @public (undocumented) export type ObjectsByEntityRequest = KubernetesRequestBody; -// @alpha (undocumented) +// @public (undocumented) export interface ObjectToFetch { // (undocumented) apiVersion: string; @@ -397,7 +397,7 @@ export interface ObjectToFetch { plural: string; } -// @alpha (undocumented) +// @public (undocumented) export class OidcKubernetesAuthTranslator implements KubernetesAuthTranslator { // (undocumented) decorateClusterDetailsWithAuth( @@ -406,7 +406,7 @@ export class OidcKubernetesAuthTranslator implements KubernetesAuthTranslator { ): Promise; } -// @alpha (undocumented) +// @public (undocumented) export interface RouterOptions { // (undocumented) catalogApi: CatalogApi; @@ -420,13 +420,13 @@ export interface RouterOptions { logger: Logger; } -// @alpha (undocumented) +// @public (undocumented) export interface ServiceAccountClusterDetails extends ClusterDetails {} -// @alpha (undocumented) +// @public (undocumented) export type ServiceLocatorMethod = 'multiTenant' | 'http'; -// @alpha (undocumented) +// @public (undocumented) export interface ServiceLocatorRequestContext { // (undocumented) customResources: CustomResourceMatcher[]; @@ -434,7 +434,7 @@ export interface ServiceLocatorRequestContext { objectTypesToFetch: Set; } -// @alpha (undocumented) +// @public (undocumented) export type SigningCreds = { accessKeyId: string | undefined; secretAccessKey: string | undefined; diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/AwsIamKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/AwsIamKubernetesAuthTranslator.ts index ccb0f28109..b89945902d 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/AwsIamKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/AwsIamKubernetesAuthTranslator.ts @@ -20,7 +20,7 @@ import { KubernetesAuthTranslator } from './types'; /** * - * @alpha + * @public */ export type SigningCreds = { accessKeyId: string | undefined; @@ -30,7 +30,7 @@ export type SigningCreds = { /** * - * @alpha + * @public */ export class AwsIamKubernetesAuthTranslator implements KubernetesAuthTranslator diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/AzureIdentityKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/AzureIdentityKubernetesAuthTranslator.ts index 6b1f2281c4..2633598d6c 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/AzureIdentityKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/AzureIdentityKubernetesAuthTranslator.ts @@ -27,7 +27,7 @@ const aksScope = '6dae42f8-4368-4678-94ff-3960e28e3630/.default'; // This scope /** * - * @alpha + * @public */ export class AzureIdentityKubernetesAuthTranslator implements KubernetesAuthTranslator diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts index cabf66b40b..e8dae56997 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts @@ -20,7 +20,7 @@ import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common'; /** * - * @alpha + * @public */ export class GoogleKubernetesAuthTranslator implements KubernetesAuthTranslator diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleServiceAccountAuthProvider.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleServiceAccountAuthProvider.ts index 1eca62b363..cca510ad6c 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleServiceAccountAuthProvider.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleServiceAccountAuthProvider.ts @@ -19,7 +19,7 @@ import * as container from '@google-cloud/container'; /** * - * @alpha + * @public */ export class GoogleServiceAccountAuthTranslator implements KubernetesAuthTranslator diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/KubernetesAuthTranslatorGenerator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/KubernetesAuthTranslatorGenerator.ts index d4eed29653..f54e46efab 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/KubernetesAuthTranslatorGenerator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/KubernetesAuthTranslatorGenerator.ts @@ -25,7 +25,7 @@ import { OidcKubernetesAuthTranslator } from './OidcKubernetesAuthTranslator'; /** * - * @alpha + * @public */ export class KubernetesAuthTranslatorGenerator { static getKubernetesAuthTranslatorInstance( diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/NoopKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/NoopKubernetesAuthTranslator.ts index 2ef78495a1..32aa141e50 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/NoopKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/NoopKubernetesAuthTranslator.ts @@ -19,7 +19,7 @@ import { ServiceAccountClusterDetails } from '../types/types'; /** * - * @alpha + * @public */ export class NoopKubernetesAuthTranslator implements KubernetesAuthTranslator { async decorateClusterDetailsWithAuth( diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/OidcKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/OidcKubernetesAuthTranslator.ts index e5450b2fe1..cee1ec1e0c 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/OidcKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/OidcKubernetesAuthTranslator.ts @@ -20,7 +20,7 @@ import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common'; /** * - * @alpha + * @public */ export class OidcKubernetesAuthTranslator implements KubernetesAuthTranslator { async decorateClusterDetailsWithAuth( diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts index f8417f8468..efbbff8250 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts @@ -19,7 +19,7 @@ import { KubernetesRequestAuth } from '@backstage/plugin-kubernetes-common'; /** * - * @alpha + * @public */ export interface KubernetesAuthTranslator { decorateClusterDetailsWithAuth( diff --git a/plugins/kubernetes-backend/src/service/KubernetesBuilder.ts b/plugins/kubernetes-backend/src/service/KubernetesBuilder.ts index 92773ece6d..74ec9eada2 100644 --- a/plugins/kubernetes-backend/src/service/KubernetesBuilder.ts +++ b/plugins/kubernetes-backend/src/service/KubernetesBuilder.ts @@ -43,7 +43,7 @@ import { KubernetesProxy } from './KubernetesProxy'; /** * - * @alpha + * @public */ export interface KubernetesEnvironment { logger: Logger; @@ -54,7 +54,7 @@ export interface KubernetesEnvironment { /** * The return type of the `KubernetesBuilder.build` method * - * @alpha + * @public */ export type KubernetesBuilderReturn = Promise<{ router: express.Router; @@ -68,7 +68,7 @@ export type KubernetesBuilderReturn = Promise<{ /** * - * @alpha + * @public */ export class KubernetesBuilder { private clusterSupplier?: KubernetesClustersSupplier; diff --git a/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts b/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts index a738c69bcc..63e46a44e3 100644 --- a/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts +++ b/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts @@ -51,7 +51,7 @@ import { /** * - * @alpha + * @public */ export const DEFAULT_OBJECTS: ObjectToFetch[] = [ { diff --git a/plugins/kubernetes-backend/src/service/KubernetesProxy.ts b/plugins/kubernetes-backend/src/service/KubernetesProxy.ts index cb36c647ac..178105ef79 100644 --- a/plugins/kubernetes-backend/src/service/KubernetesProxy.ts +++ b/plugins/kubernetes-backend/src/service/KubernetesProxy.ts @@ -39,7 +39,7 @@ export const HEADER_KUBERNETES_CLUSTER: string = 'X-Kubernetes-Cluster'; /** * A proxy that routes requests to the Kubernetes API. * - * @alpha + * @public */ export class KubernetesProxy { private readonly middlewareForClusterName = new Map(); diff --git a/plugins/kubernetes-backend/src/service/router.ts b/plugins/kubernetes-backend/src/service/router.ts index ab27a75a18..341956553e 100644 --- a/plugins/kubernetes-backend/src/service/router.ts +++ b/plugins/kubernetes-backend/src/service/router.ts @@ -24,7 +24,7 @@ import { CatalogApi } from '@backstage/catalog-client'; /** * - * @alpha + * @public */ export interface RouterOptions { logger: Logger; @@ -47,7 +47,7 @@ export interface RouterOptions { * }).build(); * ``` * - * @alpha + * @public */ export async function createRouter( options: RouterOptions, diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index d76bfc8149..25c7abfd1f 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -28,7 +28,7 @@ import type { /** * - * @alpha + * @public */ export interface ObjectFetchParams { serviceId: string; @@ -46,7 +46,7 @@ export interface ObjectFetchParams { /** * Fetches information from a kubernetes cluster using the cluster details object to target a specific cluster * - * @alpha + * @public */ export interface KubernetesFetcher { fetchObjectsForService( @@ -60,7 +60,7 @@ export interface KubernetesFetcher { /** * - * @alpha + * @public */ export interface FetchResponseWrapper { errors: KubernetesFetchError[]; @@ -69,7 +69,7 @@ export interface FetchResponseWrapper { /** * - * @alpha + * @public */ export interface ObjectToFetch { objectType: KubernetesObjectTypes; @@ -80,7 +80,7 @@ export interface ObjectToFetch { /** * - * @alpha + * @public */ export interface CustomResource extends ObjectToFetch { objectType: 'customresources'; @@ -88,7 +88,7 @@ export interface CustomResource extends ObjectToFetch { /** * - * @alpha + * @public */ export type KubernetesObjectTypes = | 'pods' @@ -107,7 +107,7 @@ export type KubernetesObjectTypes = /** * Used to load cluster details from different sources - * @alpha + * @public */ export interface KubernetesClustersSupplier { /** @@ -120,7 +120,7 @@ export interface KubernetesClustersSupplier { } /** - * @alpha + * @public */ export interface ServiceLocatorRequestContext { objectTypesToFetch: Set; @@ -129,7 +129,7 @@ export interface ServiceLocatorRequestContext { /** * Used to locate which cluster(s) a service is running on - * @alpha + * @public */ export interface KubernetesServiceLocator { getClustersByEntity( @@ -140,13 +140,13 @@ export interface KubernetesServiceLocator { /** * - * @alpha + * @public */ export type ServiceLocatorMethod = 'multiTenant' | 'http'; // TODO implement http /** * - * @alpha + * @public */ export interface ClusterDetails { /** @@ -209,25 +209,25 @@ export interface ClusterDetails { /** * - * @alpha + * @public */ export interface GKEClusterDetails extends ClusterDetails {} /** * - * @alpha + * @public */ export interface AzureClusterDetails extends ClusterDetails {} /** * - * @alpha + * @public */ export interface ServiceAccountClusterDetails extends ClusterDetails {} /** * - * @alpha + * @public */ export interface AWSClusterDetails extends ClusterDetails { assumeRole?: string; @@ -236,7 +236,7 @@ export interface AWSClusterDetails extends ClusterDetails { /** * - * @alpha + * @public */ export interface KubernetesObjectsProviderOptions { logger: Logger; @@ -248,13 +248,13 @@ export interface KubernetesObjectsProviderOptions { /** * - * @alpha + * @public */ export type ObjectsByEntityRequest = KubernetesRequestBody; /** * - * @alpha + * @public */ export interface KubernetesObjectsByEntity { entity: Entity; @@ -263,7 +263,7 @@ export interface KubernetesObjectsByEntity { /** * - * @alpha + * @public */ export interface CustomResourcesByEntity extends KubernetesObjectsByEntity { customResources: CustomResourceMatcher[]; @@ -271,7 +271,7 @@ export interface CustomResourcesByEntity extends KubernetesObjectsByEntity { /** * - * @alpha + * @public */ export interface KubernetesObjectsProvider { getKubernetesObjectsByEntity( diff --git a/plugins/kubernetes/api-report.md b/plugins/kubernetes/api-report.md index 463b4126eb..2cc2674a9e 100644 --- a/plugins/kubernetes/api-report.md +++ b/plugins/kubernetes/api-report.md @@ -101,7 +101,7 @@ export interface DeploymentResources { replicaSets: V1ReplicaSet[]; } -// @alpha +// @public export interface DetectedError { // (undocumented) cluster: string; @@ -117,10 +117,10 @@ export interface DetectedError { severity: ErrorSeverity; } -// @alpha +// @public export type DetectedErrorsByCluster = Map; -// @alpha +// @public export const detectErrors: ( objects: ObjectsByEntityResponse, ) => DetectedErrorsByCluster; @@ -137,7 +137,7 @@ export type EntityKubernetesContentProps = { refreshIntervalMs?: number; }; -// @alpha +// @public export type ErrorDetectableKind = | 'Pod' | 'Deployment' @@ -161,7 +161,7 @@ export const ErrorReporting: ({ detectedErrors, }: ErrorReportingProps) => JSX.Element; -// @alpha +// @public export type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; // Warning: (ae-forgotten-export) The symbol "FormatClusterLinkOptions" needs to be exported by the entry point index.d.ts diff --git a/plugins/kubernetes/src/error-detection/error-detection.ts b/plugins/kubernetes/src/error-detection/error-detection.ts index 3a9f1571e0..fddd4d838a 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.ts @@ -25,7 +25,7 @@ import { detectErrorsInHpa } from './hpas'; * For each cluster try to find errors in each of the object types provided * returning a map of cluster names to errors in that cluster * - * @alpha + * @public */ export const detectErrors = ( objects: ObjectsByEntityResponse, diff --git a/plugins/kubernetes/src/error-detection/types.ts b/plugins/kubernetes/src/error-detection/types.ts index 5e35cef8b6..4bc7ae164d 100644 --- a/plugins/kubernetes/src/error-detection/types.ts +++ b/plugins/kubernetes/src/error-detection/types.ts @@ -24,7 +24,7 @@ import { /** * Severity of the error, where 10 is critical and 0 is very low. * - * @alpha + * @public */ export type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; @@ -33,7 +33,7 @@ export type ErrorDetectable = V1Pod | V1Deployment | V1HorizontalPodAutoscaler; /** * Kubernetes kinds that errors might be reported by the plugin * - * @alpha + * @public */ export type ErrorDetectableKind = | 'Pod' @@ -43,14 +43,14 @@ export type ErrorDetectableKind = /** * A list of errors keyed by Cluster name * - * @alpha + * @public */ export type DetectedErrorsByCluster = Map; /** * Represents an error found on a Kubernetes object * - * @alpha + * @public */ export interface DetectedError { severity: ErrorSeverity; diff --git a/plugins/permission-node/api-report.md b/plugins/permission-node/api-report.md index 3f712fe362..569fb5c6ea 100644 --- a/plugins/permission-node/api-report.md +++ b/plugins/permission-node/api-report.md @@ -137,17 +137,17 @@ export const createPermissionRule: < rule: PermissionRule, ) => PermissionRule; -// @alpha +// @public export const isAndCriteria: ( criteria: PermissionCriteria, ) => criteria is AllOfCriteria; -// @alpha +// @public export const isNotCriteria: ( criteria: PermissionCriteria, ) => criteria is NotCriteria; -// @alpha +// @public export const isOrCriteria: ( criteria: PermissionCriteria, ) => criteria is AnyOfCriteria; diff --git a/plugins/permission-node/src/integration/util.ts b/plugins/permission-node/src/integration/util.ts index e448068e17..9be90e15fc 100644 --- a/plugins/permission-node/src/integration/util.ts +++ b/plugins/permission-node/src/integration/util.ts @@ -33,7 +33,7 @@ export type NoInfer = T extends infer S ? S : never; /** * Utility function used to parse a PermissionCriteria * @param criteria - a PermissionCriteria - * @alpha + * @public * * @returns `true` if the permission criteria is of type allOf, * narrowing down `criteria` to the specific type. @@ -46,7 +46,7 @@ export const isAndCriteria = ( /** * Utility function used to parse a PermissionCriteria of type * @param criteria - a PermissionCriteria - * @alpha + * @public * * @returns `true` if the permission criteria is of type anyOf, * narrowing down `criteria` to the specific type. @@ -59,7 +59,7 @@ export const isOrCriteria = ( /** * Utility function used to parse a PermissionCriteria * @param criteria - a PermissionCriteria - * @alpha + * @public * * @returns `true` if the permission criteria is of type not, * narrowing down `criteria` to the specific type. diff --git a/plugins/scaffolder-backend/alpha-api-report.md b/plugins/scaffolder-backend/alpha-api-report.md new file mode 100644 index 0000000000..3199444c6b --- /dev/null +++ b/plugins/scaffolder-backend/alpha-api-report.md @@ -0,0 +1,30 @@ +## API Report File for "@backstage/plugin-scaffolder-backend" + +> 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 { TaskBroker } from '@backstage/plugin-scaffolder-backend'; +import { TemplateAction } from '@backstage/plugin-scaffolder-node'; +import { TemplateFilter } from '@backstage/plugin-scaffolder-backend'; +import { TemplateGlobal } from '@backstage/plugin-scaffolder-backend'; + +// @alpha +export const catalogModuleTemplateKind: () => BackendFeature; + +// @alpha +export const scaffolderPlugin: ( + options: ScaffolderPluginOptions, +) => BackendFeature; + +// @alpha +export type ScaffolderPluginOptions = { + actions?: TemplateAction[]; + taskWorkers?: number; + taskBroker?: TaskBroker; + additionalTemplateFilters?: Record; + additionalTemplateGlobals?: Record; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder-backend/api-report.md b/plugins/scaffolder-backend/api-report.md index 0d745862a1..293ff7ed29 100644 --- a/plugins/scaffolder-backend/api-report.md +++ b/plugins/scaffolder-backend/api-report.md @@ -6,7 +6,6 @@ /// import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node'; -import { BackendFeature } from '@backstage/backend-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; import { CatalogProcessor } from '@backstage/plugin-catalog-backend'; import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; @@ -38,9 +37,6 @@ import { Writable } from 'stream'; // @public @deprecated (undocumented) export type ActionContext = ActionContext_2; -// @alpha -export const catalogModuleTemplateKind: () => BackendFeature; - // @public export const createBuiltinActions: ( options: CreateBuiltInActionsOptions, @@ -666,20 +662,6 @@ export class ScaffolderEntitiesProcessor implements CatalogProcessor { validateEntityKind(entity: Entity): Promise; } -// @alpha -export const scaffolderPlugin: ( - options: ScaffolderPluginOptions, -) => BackendFeature; - -// @alpha -export type ScaffolderPluginOptions = { - actions?: TemplateAction_2[]; - taskWorkers?: number; - taskBroker?: TaskBroker; - additionalTemplateFilters?: Record; - additionalTemplateGlobals?: Record; -}; - // @public export type SerializedTask = { id: string; diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index e9c21deeb2..121a5c8ed0 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "backend-plugin" @@ -25,7 +37,7 @@ ], "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", "prepack": "backstage-cli package prepack", @@ -100,7 +112,6 @@ "yaml": "^2.0.0" }, "files": [ - "alpha", "dist", "migrations", "config.d.ts", diff --git a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts index 3b0d26be21..182bb60223 100644 --- a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts +++ b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts @@ -20,14 +20,18 @@ import { } from '@backstage/backend-plugin-api'; import { loggerToWinstonLogger } from '@backstage/backend-common'; import { ScmIntegrations } from '@backstage/integration'; -import { catalogServiceRef } from '@backstage/plugin-catalog-node'; +import { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha'; import { scaffolderActionsExtensionPoint, ScaffolderActionsExtensionPoint, TemplateAction, } from '@backstage/plugin-scaffolder-node'; -import { TemplateFilter, TemplateGlobal } from './lib'; -import { createBuiltinActions, TaskBroker } from './scaffolder'; +import { + TemplateFilter, + TemplateGlobal, + TaskBroker, +} from '@backstage/plugin-scaffolder-backend'; +import { createBuiltinActions } from './scaffolder'; import { createRouter } from './service/router'; /** diff --git a/plugins/scaffolder-backend/src/alpha.ts b/plugins/scaffolder-backend/src/alpha.ts new file mode 100644 index 0000000000..ac96f081ad --- /dev/null +++ b/plugins/scaffolder-backend/src/alpha.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export * from './modules'; +export { scaffolderPlugin } from './ScaffolderPlugin'; +export type { ScaffolderPluginOptions } from './ScaffolderPlugin'; diff --git a/plugins/scaffolder-backend/src/index.ts b/plugins/scaffolder-backend/src/index.ts index ba69a55a24..ba2c25f80a 100644 --- a/plugins/scaffolder-backend/src/index.ts +++ b/plugins/scaffolder-backend/src/index.ts @@ -24,8 +24,5 @@ export * from './scaffolder'; export * from './service/router'; export * from './lib'; export * from './processor'; -export * from './modules'; -export { scaffolderPlugin } from './ScaffolderPlugin'; -export type { ScaffolderPluginOptions } from './ScaffolderPlugin'; export * from './deprecated'; diff --git a/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.test.ts b/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.test.ts index 7652f60386..7b8b99f5e2 100644 --- a/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.test.ts +++ b/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { ScaffolderEntitiesProcessor } from '../processor'; import { catalogModuleTemplateKind } from './catalogModuleTemplateKind'; import { startTestBackend } from '@backstage/backend-test-utils'; diff --git a/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.ts b/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.ts index 622e5a003a..3359bd1dba 100644 --- a/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.ts +++ b/plugins/scaffolder-backend/src/modules/catalogModuleTemplateKind.ts @@ -15,7 +15,7 @@ */ import { createBackendModule } from '@backstage/backend-plugin-api'; -import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; +import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha'; import { ScaffolderEntitiesProcessor } from '../processor'; /** diff --git a/plugins/scaffolder-react/alpha-api-report.md b/plugins/scaffolder-react/alpha-api-report.md new file mode 100644 index 0000000000..ad44cd3707 --- /dev/null +++ b/plugins/scaffolder-react/alpha-api-report.md @@ -0,0 +1,222 @@ +## API Report File for "@backstage/plugin-scaffolder-react" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +/// + +import { ApiHolder } from '@backstage/core-plugin-api'; +import { ComponentType } from 'react'; +import { CustomFieldExtensionSchema } from '@backstage/plugin-scaffolder-react'; +import { Dispatch } from 'react'; +import { Extension } from '@backstage/core-plugin-api'; +import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react'; +import { FieldProps } from '@rjsf/utils'; +import { FieldValidation } from '@rjsf/utils'; +import { FormProps as FormProps_2 } from '@rjsf/core-v5'; +import { IconComponent } from '@backstage/core-plugin-api'; +import { JsonObject } from '@backstage/types'; +import { JsonValue } from '@backstage/types'; +import { LayoutOptions } from '@backstage/plugin-scaffolder-react'; +import { PropsWithChildren } from 'react'; +import { default as React_2 } from 'react'; +import { ReactNode } from 'react'; +import { RJSFSchema } from '@rjsf/utils'; +import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react'; +import { SetStateAction } from 'react'; +import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; +import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; +import { UIOptionsType } from '@rjsf/utils'; +import { UiSchema } from '@rjsf/utils'; + +// @alpha +export const createFieldValidation: () => FieldValidation; + +// @alpha +export function createNextScaffolderFieldExtension< + TReturnValue = unknown, + TInputProps extends UIOptionsType = {}, +>( + options: NextFieldExtensionOptions, +): Extension>; + +// @alpha +export const DefaultTemplateOutputs: (props: { + output?: ScaffolderTaskOutput; +}) => JSX.Element | null; + +// @alpha (undocumented) +export const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element; + +// @alpha +export const extractSchemaFromStep: (inputStep: JsonObject) => { + uiSchema: UiSchema; + schema: JsonObject; +}; + +// @alpha (undocumented) +export const Form: ComponentType>; + +// @alpha +export type FormProps = Pick< + FormProps_2, + 'transformErrors' | 'noHtml5Validate' +>; + +// @alpha +export type NextCustomFieldValidator = ( + data: TFieldReturnValue, + field: FieldValidation, + context: { + apiHolder: ApiHolder; + formData: JsonObject; + schema: JsonObject; + }, +) => void | Promise; + +// @alpha +export interface NextFieldExtensionComponentProps< + TFieldReturnValue, + TUiOptions = {}, +> extends PropsWithChildren> { + // (undocumented) + uiSchema?: UiSchema & { + 'ui:options'?: TUiOptions & UIOptionsType; + }; +} + +// @alpha +export type NextFieldExtensionOptions< + TFieldReturnValue = unknown, + TInputProps = unknown, +> = { + name: string; + component: ( + props: NextFieldExtensionComponentProps, + ) => JSX.Element | null; + validation?: NextCustomFieldValidator; + schema?: CustomFieldExtensionSchema; +}; + +// @alpha +export interface ParsedTemplateSchema { + // (undocumented) + description?: string; + // (undocumented) + mergedSchema: JsonObject; + // (undocumented) + schema: JsonObject; + // (undocumented) + title: string; + // (undocumented) + uiSchema: UiSchema; +} + +// @alpha +export const ReviewState: (props: ReviewStateProps) => JSX.Element; + +// @alpha +export type ReviewStateProps = { + schemas: ParsedTemplateSchema[]; + formState: JsonObject; +}; + +// @alpha +export const Stepper: (stepperProps: StepperProps) => JSX.Element; + +// @alpha +export type StepperProps = { + manifest: TemplateParameterSchema; + extensions: NextFieldExtensionOptions[]; + templateName?: string; + FormProps?: FormProps; + initialState?: Record; + onCreate: (values: Record) => Promise; + components?: { + ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element; + createButtonText?: ReactNode; + reviewButtonText?: ReactNode; + }; + layouts?: LayoutOptions[]; +}; + +// @alpha +export const TemplateCard: (props: TemplateCardProps) => JSX.Element; + +// @alpha +export interface TemplateCardProps { + // (undocumented) + additionalLinks?: { + icon: IconComponent; + text: string; + url: string; + }[]; + // (undocumented) + onSelected?: (template: TemplateEntityV1beta3) => void; + // (undocumented) + template: TemplateEntityV1beta3; +} + +// @alpha +export const TemplateGroup: (props: TemplateGroupProps) => JSX.Element; + +// @alpha +export interface TemplateGroupProps { + // (undocumented) + components?: { + CardComponent?: React_2.ComponentType; + }; + // (undocumented) + onSelected: (template: TemplateEntityV1beta3) => void; + // (undocumented) + templates: { + template: TemplateEntityV1beta3; + additionalLinks?: { + icon: IconComponent; + text: string; + url: string; + }[]; + }[]; + // (undocumented) + title: React_2.ReactNode; +} + +// @alpha +export const useFormDataFromQuery: ( + initialState?: Record, +) => [Record, Dispatch>>]; + +// @alpha (undocumented) +export const useTemplateParameterSchema: (templateRef: string) => { + manifest: TemplateParameterSchema; + loading: boolean; + error: Error | undefined; +}; + +// @alpha +export const useTemplateSchema: (manifest: TemplateParameterSchema) => { + steps: ParsedTemplateSchema[]; +}; + +// @alpha (undocumented) +export const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null; + +// @alpha (undocumented) +export type WorkflowProps = { + title?: string; + description?: string; + namespace: string; + templateName: string; + onError(error: Error | undefined): JSX.Element | null; +} & Pick< + StepperProps, + | 'extensions' + | 'FormProps' + | 'components' + | 'onCreate' + | 'initialState' + | 'layouts' +>; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder-react/api-report.md b/plugins/scaffolder-react/api-report.md index 69bffbf724..9b50eef884 100644 --- a/plugins/scaffolder-react/api-report.md +++ b/plugins/scaffolder-react/api-report.md @@ -7,29 +7,18 @@ import { ApiHolder } from '@backstage/core-plugin-api'; import { ApiRef } from '@backstage/core-plugin-api'; -import { ComponentType } from 'react'; -import { Dispatch } from 'react'; import { Extension } from '@backstage/core-plugin-api'; import { FieldProps } from '@rjsf/core'; -import { FieldProps as FieldProps_2 } from '@rjsf/utils'; import { FieldValidation } from '@rjsf/core'; -import { FieldValidation as FieldValidation_2 } from '@rjsf/utils'; -import { FormProps as FormProps_2 } from '@rjsf/core-v5'; -import { IconComponent } from '@backstage/core-plugin-api'; +import type { FormProps } from '@rjsf/core-v5'; import { JsonObject } from '@backstage/types'; import { JSONSchema7 } from 'json-schema'; import { JsonValue } from '@backstage/types'; import { Observable } from '@backstage/types'; import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; -import { ReactNode } from 'react'; -import { RJSFSchema } from '@rjsf/utils'; -import { SetStateAction } from 'react'; import { TaskSpec } from '@backstage/plugin-scaffolder-common'; import { TaskStep } from '@backstage/plugin-scaffolder-common'; -import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; -import { UIOptionsType } from '@rjsf/utils'; -import { UiSchema } from '@rjsf/utils'; // @public export type Action = { @@ -48,17 +37,6 @@ export type ActionExample = { example: string; }; -// @alpha -export const createFieldValidation: () => FieldValidation_2; - -// @alpha -export function createNextScaffolderFieldExtension< - TReturnValue = unknown, - TInputProps extends UIOptionsType = {}, ->( - options: NextFieldExtensionOptions, -): Extension>; - // @public export function createScaffolderFieldExtension< TReturnValue = unknown, @@ -87,20 +65,6 @@ export type CustomFieldValidator = ( }, ) => void | Promise; -// @alpha -export const DefaultTemplateOutputs: (props: { - output?: ScaffolderTaskOutput; -}) => JSX.Element | null; - -// @alpha (undocumented) -export const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element; - -// @alpha -export const extractSchemaFromStep: (inputStep: JsonObject) => { - uiSchema: UiSchema; - schema: JsonObject; -}; - // @public export type FieldExtensionComponent<_TReturnValue, _TInputProps> = () => null; @@ -128,15 +92,6 @@ export type FieldExtensionOptions< schema?: CustomFieldExtensionSchema; }; -// @alpha (undocumented) -export const Form: ComponentType>; - -// @public -export type FormProps = Pick< - FormProps_2, - 'transformErrors' | 'noHtml5Validate' ->; - // @public export type LayoutComponent<_TInputProps> = () => null; @@ -150,7 +105,7 @@ export interface LayoutOptions

{ // @public export type LayoutTemplate = NonNullable< - FormProps_2['uiSchema'] + FormProps['uiSchema'] >['ui:ObjectFieldTemplate']; // @public @@ -169,64 +124,6 @@ export type LogEvent = { taskId: string; }; -// @alpha -export type NextCustomFieldValidator = ( - data: TFieldReturnValue, - field: FieldValidation_2, - context: { - apiHolder: ApiHolder; - formData: JsonObject; - schema: JsonObject; - }, -) => void | Promise; - -// @alpha -export interface NextFieldExtensionComponentProps< - TFieldReturnValue, - TUiOptions = {}, -> extends PropsWithChildren> { - // (undocumented) - uiSchema?: UiSchema & { - 'ui:options'?: TUiOptions & UIOptionsType; - }; -} - -// @alpha -export type NextFieldExtensionOptions< - TFieldReturnValue = unknown, - TInputProps = unknown, -> = { - name: string; - component: ( - props: NextFieldExtensionComponentProps, - ) => JSX.Element | null; - validation?: NextCustomFieldValidator; - schema?: CustomFieldExtensionSchema; -}; - -// @alpha -export interface ParsedTemplateSchema { - // (undocumented) - description?: string; - // (undocumented) - mergedSchema: JsonObject; - // (undocumented) - schema: JsonObject; - // (undocumented) - title: string; - // (undocumented) - uiSchema: UiSchema; -} - -// @alpha -export const ReviewState: (props: ReviewStateProps) => JSX.Element; - -// @alpha -export type ReviewStateProps = { - schemas: ParsedTemplateSchema[]; - formState: JsonObject; -}; - // @public export interface ScaffolderApi { // (undocumented) @@ -380,66 +277,6 @@ export const SecretsContextProvider: ({ children, }: PropsWithChildren<{}>) => JSX.Element; -// @alpha -export const Stepper: (stepperProps: StepperProps) => JSX.Element; - -// @alpha -export type StepperProps = { - manifest: TemplateParameterSchema; - extensions: NextFieldExtensionOptions[]; - templateName?: string; - FormProps?: FormProps; - initialState?: Record; - onCreate: (values: Record) => Promise; - components?: { - ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element; - createButtonText?: ReactNode; - reviewButtonText?: ReactNode; - }; - layouts?: LayoutOptions[]; -}; - -// @alpha -export const TemplateCard: (props: TemplateCardProps) => JSX.Element; - -// @alpha -export interface TemplateCardProps { - // (undocumented) - additionalLinks?: { - icon: IconComponent; - text: string; - url: string; - }[]; - // (undocumented) - onSelected?: (template: TemplateEntityV1beta3) => void; - // (undocumented) - template: TemplateEntityV1beta3; -} - -// @alpha -export const TemplateGroup: (props: TemplateGroupProps) => JSX.Element; - -// @alpha -export interface TemplateGroupProps { - // (undocumented) - components?: { - CardComponent?: React_2.ComponentType; - }; - // (undocumented) - onSelected: (template: TemplateEntityV1beta3) => void; - // (undocumented) - templates: { - template: TemplateEntityV1beta3; - additionalLinks?: { - icon: IconComponent; - text: string; - url: string; - }[]; - }[]; - // (undocumented) - title: React_2.ReactNode; -} - // @public export type TemplateParameterSchema = { title: string; @@ -463,45 +300,8 @@ export const useCustomLayouts: >( outlet: React.ReactNode, ) => TComponentDataType[]; -// @alpha -export const useFormDataFromQuery: ( - initialState?: Record, -) => [Record, Dispatch>>]; - -// @alpha (undocumented) -export const useTemplateParameterSchema: (templateRef: string) => { - manifest: TemplateParameterSchema | undefined; - loading: boolean; - error: Error | undefined; -}; - -// @alpha -export const useTemplateSchema: (manifest: TemplateParameterSchema) => { - steps: ParsedTemplateSchema[]; -}; - // @public export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets; -// @alpha (undocumented) -export const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null; - -// @alpha (undocumented) -export type WorkflowProps = { - title?: string; - description?: string; - namespace: string; - templateName: string; - onError(error: Error | undefined): JSX.Element | null; -} & Pick< - StepperProps, - | 'extensions' - | 'FormProps' - | 'components' - | 'onCreate' - | 'initialState' - | 'layouts' ->; - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/scaffolder-react/package.json b/plugins/scaffolder-react/package.json index 043c9d5ee2..14d25136e0 100644 --- a/plugins/scaffolder-react/package.json +++ b/plugins/scaffolder-react/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "web-library" @@ -24,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -80,7 +92,6 @@ "@testing-library/user-event": "^14.0.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/plugins/scaffolder-react/src/alpha.ts b/plugins/scaffolder-react/src/alpha.ts new file mode 100644 index 0000000000..731b8e07d9 --- /dev/null +++ b/plugins/scaffolder-react/src/alpha.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export * from './next'; +export type { FormProps } from './next'; diff --git a/plugins/scaffolder-react/src/index.ts b/plugins/scaffolder-react/src/index.ts index 67703e3ed1..1b20c19414 100644 --- a/plugins/scaffolder-react/src/index.ts +++ b/plugins/scaffolder-react/src/index.ts @@ -20,5 +20,3 @@ export * from './secrets'; export * from './api'; export * from './hooks'; export * from './layouts'; - -export * from './next'; diff --git a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx index bb2844fd52..444e463064 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx +++ b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx @@ -26,7 +26,7 @@ import { type IChangeEvent } from '@rjsf/core-v5'; import { ErrorSchema } from '@rjsf/utils'; import React, { useCallback, useMemo, useState, type ReactNode } from 'react'; import { NextFieldExtensionOptions } from '../../extensions'; -import { TemplateParameterSchema } from '../../../types'; +import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; import { createAsyncValidators, type FormValidation, @@ -36,7 +36,7 @@ import { useTemplateSchema } from '../../hooks/useTemplateSchema'; import validator from '@rjsf/validator-ajv8'; import { useFormDataFromQuery } from '../../hooks'; import { FormProps } from '../../types'; -import { LayoutOptions } from '../../../layouts'; +import { LayoutOptions } from '@backstage/plugin-scaffolder-react'; import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps'; import { hasErrors } from './utils'; import * as FieldOverrides from './FieldOverrides'; diff --git a/plugins/scaffolder-react/src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx b/plugins/scaffolder-react/src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx index 5fbd3a5142..4d908461b0 100644 --- a/plugins/scaffolder-react/src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx +++ b/plugins/scaffolder-react/src/next/components/TemplateOutputs/DefaultTemplateOutputs.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { Box, Paper } from '@material-ui/core'; import { LinkOutputs } from './LinkOutputs'; -import { ScaffolderTaskOutput } from '../../../api'; +import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react'; /** * The DefaultOutputs renderer for the scaffolder task output diff --git a/plugins/scaffolder-react/src/next/extensions/index.tsx b/plugins/scaffolder-react/src/next/extensions/index.tsx index ee9b1cd326..b2d402c93f 100644 --- a/plugins/scaffolder-react/src/next/extensions/index.tsx +++ b/plugins/scaffolder-react/src/next/extensions/index.tsx @@ -21,7 +21,8 @@ import { } from './types'; import { Extension, attachComponentData } from '@backstage/core-plugin-api'; import { UIOptionsType } from '@rjsf/utils'; -import { FieldExtensionComponent } from '../../extensions'; +// eslint-disable-next-line import/no-extraneous-dependencies +import { FieldExtensionComponent } from '@backstage/plugin-scaffolder-react'; import { FIELD_EXTENSION_KEY } from '../../extensions/keys'; /** diff --git a/plugins/scaffolder-react/src/next/extensions/types.ts b/plugins/scaffolder-react/src/next/extensions/types.ts index 1e4c671511..0917efe85d 100644 --- a/plugins/scaffolder-react/src/next/extensions/types.ts +++ b/plugins/scaffolder-react/src/next/extensions/types.ts @@ -22,7 +22,7 @@ import { } from '@rjsf/utils'; import { PropsWithChildren } from 'react'; import { JsonObject } from '@backstage/types'; -import { CustomFieldExtensionSchema } from '../../extensions'; +import { CustomFieldExtensionSchema } from '@backstage/plugin-scaffolder-react'; /** * Type for Field Extension Props for RJSF v5 diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts b/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts index 36b8b1e0bc..d060b9a09f 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts +++ b/plugins/scaffolder-react/src/next/hooks/useTemplateParameterSchema.ts @@ -1,5 +1,3 @@ -import { useApi } from '@backstage/core-plugin-api'; - /* * Copyright 2023 The Backstage Authors * @@ -15,8 +13,11 @@ import { useApi } from '@backstage/core-plugin-api'; * See the License for the specific language governing permissions and * limitations under the License. */ + import useAsync from 'react-use/lib/useAsync'; import { scaffolderApiRef } from '../../api/ref'; +import { useApi } from '@backstage/core-plugin-api'; +import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; /** * @alpha @@ -28,5 +29,5 @@ export const useTemplateParameterSchema = (templateRef: string) => { [scaffolderApi, templateRef], ); - return { manifest: value, loading, error }; + return { manifest: value as TemplateParameterSchema, loading, error }; }; diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx index 153c48468d..ab33652338 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx +++ b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.test.tsx @@ -18,7 +18,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { TestApiProvider } from '@backstage/test-utils'; import React from 'react'; import { featureFlagsApiRef } from '@backstage/core-plugin-api'; -import { TemplateParameterSchema } from '../../types'; +import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; describe('useTemplateSchema', () => { it('should generate the correct schema', () => { diff --git a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts index 2b2e48cf68..26980b15cf 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts +++ b/plugins/scaffolder-react/src/next/hooks/useTemplateSchema.ts @@ -16,7 +16,7 @@ import { featureFlagsApiRef, useApi } from '@backstage/core-plugin-api'; import { JsonObject } from '@backstage/types'; import { UiSchema } from '@rjsf/utils'; -import { TemplateParameterSchema } from '../../types'; +import { TemplateParameterSchema } from '@backstage/plugin-scaffolder-react'; import { extractSchemaFromStep } from '../lib'; /** diff --git a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts index 881c4f90c5..612ad5427b 100644 --- a/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts +++ b/plugins/scaffolder-react/src/next/hooks/useTransformSchemaToProps.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { type ParsedTemplateSchema } from './useTemplateSchema'; -import { type LayoutOptions } from '../../layouts'; +import { type LayoutOptions } from '@backstage/plugin-scaffolder-react'; interface Options { layouts?: LayoutOptions[]; diff --git a/plugins/scaffolder-react/src/next/types.ts b/plugins/scaffolder-react/src/next/types.ts index 54a64a5323..192fdf4146 100644 --- a/plugins/scaffolder-react/src/next/types.ts +++ b/plugins/scaffolder-react/src/next/types.ts @@ -23,7 +23,7 @@ import type { FormProps as SchemaFormProps } from '@rjsf/core-v5'; /** * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage` * - * @public + * @alpha */ export type FormProps = Pick< SchemaFormProps, diff --git a/plugins/scaffolder/alpha-api-report.md b/plugins/scaffolder/alpha-api-report.md new file mode 100644 index 0000000000..bf37acafc3 --- /dev/null +++ b/plugins/scaffolder/alpha-api-report.md @@ -0,0 +1,70 @@ +## API Report File for "@backstage/plugin-scaffolder" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +/// + +import { Entity } from '@backstage/catalog-model'; +import { FormProps as FormProps_2 } from '@backstage/plugin-scaffolder-react/alpha'; +import type { FormProps as FormProps_3 } from '@rjsf/core-v5'; +import { PathParams } from '@backstage/core-plugin-api'; +import { PropsWithChildren } from 'react'; +import { default as React_2 } from 'react'; +import { RouteRef } from '@backstage/core-plugin-api'; +import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react'; +import { SubRouteRef } from '@backstage/core-plugin-api'; +import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; + +// @alpha @deprecated +export type FormProps = Pick< + FormProps_3, + 'transformErrors' | 'noHtml5Validate' +>; + +// @alpha (undocumented) +export const nextRouteRef: RouteRef; + +// @alpha +export type NextRouterProps = { + components?: { + TemplateCardComponent?: React_2.ComponentType<{ + template: TemplateEntityV1beta3; + }>; + TaskPageComponent?: React_2.ComponentType<{}>; + TemplateOutputsComponent?: React_2.ComponentType<{ + output?: ScaffolderTaskOutput; + }>; + }; + groups?: TemplateGroupFilter[]; + FormProps?: FormProps_2; + contextMenu?: { + editor?: boolean; + actions?: boolean; + tasks?: boolean; + }; +}; + +// @alpha +export const NextScaffolderPage: ( + props: PropsWithChildren, +) => JSX.Element; + +// @alpha (undocumented) +export const nextScaffolderTaskRouteRef: SubRouteRef< + PathParams<'/tasks/:taskId'> +>; + +// @alpha (undocumented) +export const nextSelectedTemplateRouteRef: SubRouteRef< + PathParams<'/templates/:namespace/:templateName'> +>; + +// @alpha (undocumented) +export type TemplateGroupFilter = { + title?: React_2.ReactNode; + filter: (entity: Entity) => boolean; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 43b885b81a..43cc657a03 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -21,8 +21,6 @@ import { FieldExtensionComponent as FieldExtensionComponent_2 } from '@backstage import { FieldExtensionComponentProps as FieldExtensionComponentProps_2 } from '@backstage/plugin-scaffolder-react'; import { FieldExtensionOptions as FieldExtensionOptions_2 } from '@backstage/plugin-scaffolder-react'; import { FieldValidation } from '@rjsf/core'; -import { FormProps as FormProps_2 } from '@backstage/plugin-scaffolder-react'; -import type { FormProps as FormProps_3 } from '@rjsf/core-v5'; import { IdentityApi } from '@backstage/core-plugin-api'; import { JsonObject } from '@backstage/types'; import { LayoutOptions as LayoutOptions_2 } from '@backstage/plugin-scaffolder-react'; @@ -31,7 +29,6 @@ import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin- import { LogEvent as LogEvent_2 } from '@backstage/plugin-scaffolder-react'; import { Observable } from '@backstage/types'; import { PathParams } from '@backstage/core-plugin-api'; -import { PropsWithChildren } from 'react'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; @@ -155,12 +152,6 @@ export interface FieldSchema { readonly uiOptionsType: TUiOptions; } -// @alpha @deprecated -export type FormProps = Pick< - FormProps_3, - 'transformErrors' | 'noHtml5Validate' ->; - // @public @deprecated (undocumented) export type LayoutOptions = LayoutOptions_2; @@ -187,44 +178,6 @@ export function makeFieldSchemaFromZod< : never >; -// @alpha (undocumented) -export const nextRouteRef: RouteRef; - -// @alpha -export type NextRouterProps = { - components?: { - TemplateCardComponent?: React_2.ComponentType<{ - template: TemplateEntityV1beta3; - }>; - TaskPageComponent?: React_2.ComponentType<{}>; - TemplateOutputsComponent?: React_2.ComponentType<{ - output?: ScaffolderTaskOutput_2; - }>; - }; - groups?: TemplateGroupFilter[]; - FormProps?: FormProps_2; - contextMenu?: { - editor?: boolean; - actions?: boolean; - tasks?: boolean; - }; -}; - -// @alpha -export const NextScaffolderPage: ( - props: PropsWithChildren, -) => JSX.Element; - -// @alpha (undocumented) -export const nextScaffolderTaskRouteRef: SubRouteRef< - PathParams<'/tasks/:taskId'> ->; - -// @alpha (undocumented) -export const nextSelectedTemplateRouteRef: SubRouteRef< - PathParams<'/templates/:namespace/:templateName'> ->; - // @public export const OwnedEntityPickerFieldExtension: FieldExtensionComponent_2< string, @@ -514,12 +467,6 @@ export type TaskPageProps = { loadingText?: string; }; -// @alpha (undocumented) -export type TemplateGroupFilter = { - title?: React_2.ReactNode; - filter: (entity: Entity) => boolean; -}; - // @public @deprecated (undocumented) export type TemplateParameterSchema = TemplateParameterSchema_2; diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 5eac3c7a0d..15893b7ccb 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -6,10 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "frontend-plugin" @@ -24,7 +36,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "start": "backstage-cli package start", "lint": "backstage-cli package lint", "test": "backstage-cli package test", @@ -99,7 +111,6 @@ "msw": "^0.49.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/plugins/scaffolder/src/alpha.ts b/plugins/scaffolder/src/alpha.ts new file mode 100644 index 0000000000..a460b0d7cc --- /dev/null +++ b/plugins/scaffolder/src/alpha.ts @@ -0,0 +1,25 @@ +/* + * 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 { NextScaffolderPage } from './plugin'; +export { + nextRouteRef, + nextScaffolderTaskRouteRef, + nextSelectedTemplateRouteRef, + type TemplateGroupFilter, + type NextRouterProps, + type FormProps, +} from './next'; diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx b/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx index a74b65b885..0924c4f2e6 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx +++ b/plugins/scaffolder/src/components/MultistepJsonForm/MultistepJsonForm.tsx @@ -37,11 +37,9 @@ import cloneDeep from 'lodash/cloneDeep'; import * as fieldOverrides from './FieldOverrides'; import { ReviewStepProps } from '../types'; import { ReviewStep } from './ReviewStep'; -import { - extractSchemaFromStep, - type LayoutOptions, -} from '@backstage/plugin-scaffolder-react'; +import { extractSchemaFromStep } from '@backstage/plugin-scaffolder-react/alpha'; import { selectedTemplateRouteRef } from '../../routes'; +import { LayoutOptions } from '@backstage/plugin-scaffolder-react'; const Form = withTheme(MuiTheme); diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 50221f3a83..e153c2e232 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -36,7 +36,7 @@ import { import React, { ComponentType } from 'react'; import { TemplateList } from '../TemplateList'; import { TemplateTypePicker } from '../TemplateTypePicker'; -import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha'; import { usePermission } from '@backstage/plugin-permission-react'; import { ScaffolderPageContextMenu } from './ScaffolderPageContextMenu'; import { registerComponentRouteRef } from '../../routes'; diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index aa78874f9d..bc56629a2c 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -34,14 +34,3 @@ export { export * from './components'; export * from './deprecated'; - -/** next exports */ -export { NextScaffolderPage } from './plugin'; -export { - nextRouteRef, - nextScaffolderTaskRouteRef, - nextSelectedTemplateRouteRef, - type TemplateGroupFilter, - type NextRouterProps, - type FormProps, -} from './next'; diff --git a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx index a68df01ed5..d0aaf4b838 100644 --- a/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx @@ -25,10 +25,8 @@ import { nextSelectedTemplateRouteRef } from '../routes'; import { useRouteRef } from '@backstage/core-plugin-api'; import qs from 'qs'; import { ContextMenu } from './ContextMenu'; -import { - DefaultTemplateOutputs, - ScaffolderTaskOutput, -} from '@backstage/plugin-scaffolder-react'; +import { ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react'; +import { DefaultTemplateOutputs } from '@backstage/plugin-scaffolder-react/alpha'; const useStyles = makeStyles({ contentWrapper: { diff --git a/plugins/scaffolder/src/next/Router/Router.tsx b/plugins/scaffolder/src/next/Router/Router.tsx index ded344b048..5e199cae9b 100644 --- a/plugins/scaffolder/src/next/Router/Router.tsx +++ b/plugins/scaffolder/src/next/Router/Router.tsx @@ -19,11 +19,13 @@ import { TemplateListPage } from '../TemplateListPage'; import { TemplateWizardPage } from '../TemplateWizardPage'; import { NextFieldExtensionOptions, + FormProps, +} from '@backstage/plugin-scaffolder-react/alpha'; +import { ScaffolderTaskOutput, SecretsContextProvider, useCustomFieldExtensions, useCustomLayouts, - type FormProps, } from '@backstage/plugin-scaffolder-react'; import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/CustomFieldExplorer.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/CustomFieldExplorer.tsx index d0852a6a31..823d5b164a 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/CustomFieldExplorer.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/CustomFieldExplorer.tsx @@ -34,7 +34,7 @@ import yaml from 'yaml'; import { NextFieldExtensionOptions, Form, -} from '@backstage/plugin-scaffolder-react'; +} from '@backstage/plugin-scaffolder-react/alpha'; import { TemplateEditorForm } from './TemplateEditorForm'; import validator from '@rjsf/validator-ajv8'; diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditor.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditor.tsx index 4cdd383f83..16067e8095 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditor.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditor.tsx @@ -15,10 +15,8 @@ */ import { makeStyles } from '@material-ui/core'; import React, { useState } from 'react'; -import type { - LayoutOptions, - NextFieldExtensionOptions, -} from '@backstage/plugin-scaffolder-react'; +import type { LayoutOptions } from '@backstage/plugin-scaffolder-react'; +import { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha'; import { TemplateDirectoryAccess } from '../../lib/filesystem'; import { DirectoryEditorProvider } from '../../components/TemplateEditorPage/DirectoryEditorContext'; import { DryRunProvider } from '../../components/TemplateEditorPage/DryRunContext'; diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorForm.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorForm.tsx index 5dc841cf20..898487e200 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorForm.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorForm.tsx @@ -21,10 +21,12 @@ import useDebounce from 'react-use/lib/useDebounce'; import yaml from 'yaml'; import { LayoutOptions, - NextFieldExtensionOptions, - Stepper, TemplateParameterSchema, } from '@backstage/plugin-scaffolder-react'; +import { + NextFieldExtensionOptions, + Stepper, +} from '@backstage/plugin-scaffolder-react/alpha'; import { useDryRun } from '../../components/TemplateEditorPage/DryRunContext'; import { useDirectoryEditor } from '../../components/TemplateEditorPage/DirectoryEditorContext'; diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx index 92387fd69d..9863e99c73 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx @@ -22,10 +22,8 @@ import { import { CustomFieldExplorer } from './CustomFieldExplorer'; import { TemplateEditor } from './TemplateEditor'; import { TemplateFormPreviewer } from './TemplateFormPreviewer'; -import { - NextFieldExtensionOptions, - type LayoutOptions, -} from '@backstage/plugin-scaffolder-react'; +import { type LayoutOptions } from '@backstage/plugin-scaffolder-react'; +import { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha'; import { TemplateEditorIntro } from '../../components/TemplateEditorPage/TemplateEditorIntro'; type Selection = diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateFormPreviewer.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateFormPreviewer.tsx index 1476cda2d0..2aa1cc764d 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateFormPreviewer.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateFormPreviewer.tsx @@ -32,10 +32,8 @@ import CloseIcon from '@material-ui/icons/Close'; import React, { useCallback, useState } from 'react'; import useAsync from 'react-use/lib/useAsync'; import yaml from 'yaml'; -import { - NextFieldExtensionOptions, - type LayoutOptions, -} from '@backstage/plugin-scaffolder-react'; +import { type LayoutOptions } from '@backstage/plugin-scaffolder-react'; +import { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha'; import { TemplateEditorForm } from './TemplateEditorForm'; import { TemplateEditorTextArea } from '../../components/TemplateEditorPage/TemplateEditorTextArea'; diff --git a/plugins/scaffolder/src/next/TemplateListPage/RegisterExistingButton.tsx b/plugins/scaffolder/src/next/TemplateListPage/RegisterExistingButton.tsx index 16e0a355a3..069a2cc6c5 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/RegisterExistingButton.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/RegisterExistingButton.tsx @@ -21,7 +21,7 @@ import useMediaQuery from '@material-ui/core/useMediaQuery'; import React from 'react'; import { Link as RouterLink, LinkProps } from 'react-router-dom'; import AddCircleOutline from '@material-ui/icons/AddCircleOutline'; -import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha'; import { usePermission } from '@backstage/plugin-permission-react'; /** diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx index f76c1a4ab6..6fe2d6beb9 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.test.tsx @@ -18,7 +18,7 @@ jest.mock('@backstage/plugin-catalog-react', () => ({ useEntityList: jest.fn(), })); -jest.mock('@backstage/plugin-scaffolder-react', () => ({ +jest.mock('@backstage/plugin-scaffolder-react/alpha', () => ({ TemplateGroup: jest.fn(() => null), })); @@ -27,7 +27,7 @@ import { useEntityList } from '@backstage/plugin-catalog-react'; import { TemplateGroups } from './TemplateGroups'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import { errorApiRef } from '@backstage/core-plugin-api'; -import { TemplateGroup } from '@backstage/plugin-scaffolder-react'; +import { TemplateGroup } from '@backstage/plugin-scaffolder-react/alpha'; import { nextRouteRef } from '../routes'; describe('TemplateGroups', () => { diff --git a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx index 485b0e40cd..590ef802bd 100644 --- a/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx +++ b/plugins/scaffolder/src/next/TemplateListPage/TemplateGroups.tsx @@ -30,7 +30,7 @@ import { useApp, useRouteRef, } from '@backstage/core-plugin-api'; -import { TemplateGroup } from '@backstage/plugin-scaffolder-react'; +import { TemplateGroup } from '@backstage/plugin-scaffolder-react/alpha'; import { viewTechDocRouteRef } from '../../routes'; import { nextSelectedTemplateRouteRef } from '../routes'; import { useNavigate } from 'react-router-dom'; diff --git a/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx b/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx index b71d0bd7a3..4825715fcb 100644 --- a/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx +++ b/plugins/scaffolder/src/next/TemplateWizardPage/TemplateWizardPage.tsx @@ -25,13 +25,13 @@ import { import { scaffolderApiRef, useTemplateSecrets, - Workflow, type LayoutOptions, } from '@backstage/plugin-scaffolder-react'; import { - NextFieldExtensionOptions, FormProps, -} from '@backstage/plugin-scaffolder-react'; + Workflow, + NextFieldExtensionOptions, +} from '@backstage/plugin-scaffolder-react/alpha'; import { JsonValue } from '@backstage/types'; import { Header, Page } from '@backstage/core-components'; import { diff --git a/plugins/sonarqube-react/alpha-api-report.md b/plugins/sonarqube-react/alpha-api-report.md new file mode 100644 index 0000000000..4fad469d12 --- /dev/null +++ b/plugins/sonarqube-react/alpha-api-report.md @@ -0,0 +1,65 @@ +## API Report File for "@backstage/plugin-sonarqube-react" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { ApiRef } from '@backstage/core-plugin-api'; +import { Entity } from '@backstage/catalog-model'; + +// @public (undocumented) +export interface FindingSummary { + // (undocumented) + getComponentMeasuresUrl: SonarUrlProcessorFunc; + // (undocumented) + getIssuesUrl: SonarUrlProcessorFunc; + // (undocumented) + getSecurityHotspotsUrl: () => string; + // (undocumented) + lastAnalysis: string; + // (undocumented) + metrics: Metrics; + // (undocumented) + projectUrl: string; +} + +// @public (undocumented) +export type MetricKey = + | 'alert_status' + | 'bugs' + | 'reliability_rating' + | 'vulnerabilities' + | 'security_rating' + | 'code_smells' + | 'sqale_rating' + | 'security_hotspots_reviewed' + | 'security_review_rating' + | 'coverage' + | 'duplicated_lines_density'; + +// @public +export type Metrics = { + [key in MetricKey]: string | undefined; +}; + +// @public (undocumented) +export type SonarQubeApi = { + getFindingSummary(options: { + componentKey?: string; + projectInstance?: string; + }): Promise; +}; + +// @public (undocumented) +export const sonarQubeApiRef: ApiRef; + +// @public (undocumented) +export type SonarUrlProcessorFunc = (identifier: string) => string; + +// @public +export const useProjectInfo: (entity: Entity) => { + projectInstance: string | undefined; + projectKey: string | undefined; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/sonarqube-react/package.json b/plugins/sonarqube-react/package.json index 9006d77e84..80177d9e24 100644 --- a/plugins/sonarqube-react/package.json +++ b/plugins/sonarqube-react/package.json @@ -5,10 +5,18 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "web-library" @@ -23,7 +31,7 @@ "backstage" ], "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", diff --git a/plugins/sonarqube/dev/index.tsx b/plugins/sonarqube/dev/index.tsx index a34c4d4e82..8d38c7314a 100644 --- a/plugins/sonarqube/dev/index.tsx +++ b/plugins/sonarqube/dev/index.tsx @@ -22,10 +22,10 @@ import { EntitySonarQubeCard, sonarQubePlugin } from '../src'; import { Content, Header, Page } from '@backstage/core-components'; import { FindingSummary, - SONARQUBE_PROJECT_KEY_ANNOTATION, SonarQubeApi, sonarQubeApiRef, } from '@backstage/plugin-sonarqube-react'; +import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage/plugin-sonarqube-react'; const entity = (name?: string) => ({ diff --git a/plugins/sonarqube/src/api/types.ts b/plugins/sonarqube/src/api/types.ts index 470d05903a..29b7e7ca54 100644 --- a/plugins/sonarqube/src/api/types.ts +++ b/plugins/sonarqube/src/api/types.ts @@ -14,8 +14,10 @@ * limitations under the License. */ -import { MetricKey as NonDeprecatedMetricKey } from '@backstage/plugin-sonarqube-react'; -import { SonarUrlProcessorFunc as NonDeprecatedSonarUrlProcessorFunc } from '@backstage/plugin-sonarqube-react'; +import { + MetricKey as NonDeprecatedMetricKey, + SonarUrlProcessorFunc as NonDeprecatedSonarUrlProcessorFunc, +} from '@backstage/plugin-sonarqube-react'; export interface InstanceUrlWrapper { instanceUrl: string; diff --git a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx index 5bd1cd8e9f..932641e48d 100644 --- a/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx +++ b/plugins/sonarqube/src/components/SonarQubeCard/SonarQubeCard.tsx @@ -16,10 +16,10 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import { - SONARQUBE_PROJECT_KEY_ANNOTATION, sonarQubeApiRef, useProjectInfo, } from '@backstage/plugin-sonarqube-react'; +import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage/plugin-sonarqube-react'; import { Chip, Grid } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import BugReport from '@material-ui/icons/BugReport'; diff --git a/plugins/sonarqube/src/components/SonarQubeContentPage/SonarQubeContentPage.test.tsx b/plugins/sonarqube/src/components/SonarQubeContentPage/SonarQubeContentPage.test.tsx index 59258e5312..0bf5f04640 100644 --- a/plugins/sonarqube/src/components/SonarQubeContentPage/SonarQubeContentPage.test.tsx +++ b/plugins/sonarqube/src/components/SonarQubeContentPage/SonarQubeContentPage.test.tsx @@ -18,10 +18,10 @@ import { EntityProvider } from '@backstage/plugin-catalog-react'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import React from 'react'; import { - isSonarQubeAvailable, - SONARQUBE_PROJECT_KEY_ANNOTATION, SonarQubeApi, sonarQubeApiRef, + isSonarQubeAvailable, + SONARQUBE_PROJECT_KEY_ANNOTATION, } from '@backstage/plugin-sonarqube-react'; const Providers = ({ diff --git a/plugins/techdocs-backend/src/search/DefaultTechDocsCollator.ts b/plugins/techdocs-backend/src/search/DefaultTechDocsCollator.ts index a76ea66729..86ab9e6cd8 100644 --- a/plugins/techdocs-backend/src/search/DefaultTechDocsCollator.ts +++ b/plugins/techdocs-backend/src/search/DefaultTechDocsCollator.ts @@ -29,7 +29,7 @@ import unescape from 'lodash/unescape'; import { Logger } from 'winston'; import pLimit from 'p-limit'; import { Config } from '@backstage/config'; -import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha'; import { Permission } from '@backstage/plugin-permission-common'; import { CatalogApi, diff --git a/plugins/techdocs-backend/src/search/DefaultTechDocsCollatorFactory.ts b/plugins/techdocs-backend/src/search/DefaultTechDocsCollatorFactory.ts index aaddb4fa51..e2c6f5913c 100644 --- a/plugins/techdocs-backend/src/search/DefaultTechDocsCollatorFactory.ts +++ b/plugins/techdocs-backend/src/search/DefaultTechDocsCollatorFactory.ts @@ -30,7 +30,7 @@ import { stringifyEntityRef, } from '@backstage/catalog-model'; import { Config } from '@backstage/config'; -import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common'; +import { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha'; import { Permission } from '@backstage/plugin-permission-common'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; import { TechDocsDocument } from '@backstage/plugin-techdocs-node'; diff --git a/plugins/techdocs-react/package.json b/plugins/techdocs-react/package.json index 34f78f9d84..7f7fd06bec 100644 --- a/plugins/techdocs-react/package.json +++ b/plugins/techdocs-react/package.json @@ -4,7 +4,6 @@ "version": "1.1.3", "publishConfig": { "access": "public", - "alphaTypes": "dist/index.alpha.d.ts", "main": "dist/index.esm.js", "types": "dist/index.d.ts" }, @@ -25,7 +24,7 @@ "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", diff --git a/plugins/todo-backend/api-report.md b/plugins/todo-backend/api-report.md index dabe2fbfd4..6db1e012e9 100644 --- a/plugins/todo-backend/api-report.md +++ b/plugins/todo-backend/api-report.md @@ -90,7 +90,7 @@ export type TodoParserResult = { lineNumber: number; }; -// @alpha +// @public export const todoPlugin: () => BackendFeature; // @public (undocumented) @@ -118,7 +118,7 @@ export type TodoReaderServiceOptions = { defaultPageSize?: number; }; -// @alpha (undocumented) +// @public (undocumented) export const todoReaderServiceRef: ServiceRef; // @public (undocumented) diff --git a/plugins/todo-backend/src/lib/TodoReader/TodoScmReader.ts b/plugins/todo-backend/src/lib/TodoReader/TodoScmReader.ts index 2804da98cc..276d176efb 100644 --- a/plugins/todo-backend/src/lib/TodoReader/TodoScmReader.ts +++ b/plugins/todo-backend/src/lib/TodoReader/TodoScmReader.ts @@ -174,7 +174,7 @@ export class TodoScmReader implements TodoReader { } /** - * @alpha + * @public */ export const todoReaderServiceRef = createServiceRef({ id: 'todo.todoReader', diff --git a/plugins/todo-backend/src/plugin.ts b/plugins/todo-backend/src/plugin.ts index cbb581f336..b9a73a84ee 100644 --- a/plugins/todo-backend/src/plugin.ts +++ b/plugins/todo-backend/src/plugin.ts @@ -24,7 +24,7 @@ import { createRouter } from './service/router'; /** * The Todos plugin is responsible for aggregating todo comments within source. - * @alpha + * @public */ export const todoPlugin = createBackendPlugin({ pluginId: 'todo-backend', diff --git a/plugins/todo-backend/src/service/TodoReaderService.ts b/plugins/todo-backend/src/service/TodoReaderService.ts index c5fa0aa70b..6ce38709f1 100644 --- a/plugins/todo-backend/src/service/TodoReaderService.ts +++ b/plugins/todo-backend/src/service/TodoReaderService.ts @@ -25,7 +25,7 @@ import { createServiceRef, ServiceRef, } from '@backstage/backend-plugin-api'; -import { catalogServiceRef } from '@backstage/plugin-catalog-node'; +import { catalogServiceRef } from '@backstage/plugin-catalog-node/alpha'; import { TodoReader, todoReaderServiceRef } from '../lib'; import { ListTodosRequest, ListTodosResponse, TodoService } from './types'; diff --git a/scripts/check-docs-quality.js b/scripts/check-docs-quality.js index 3dcbd6ef81..2890f1cf33 100755 --- a/scripts/check-docs-quality.js +++ b/scripts/check-docs-quality.js @@ -21,7 +21,7 @@ const IGNORED = [ /^ADOPTERS\.md$/, /^OWNERS\.md$/, /^.*[/\\]CHANGELOG\.md$/, - /^.*[/\\]api-report\.md$/, + /^.*[/\\]([^\/]+-)?api-report\.md$/, /^docs[/\\]releases[/\\].*-changelog\.md$/, /^docs[/\\]reference[/\\]/, ]; diff --git a/yarn.lock b/yarn.lock index e6644d0af4..d20206d507 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8646,6 +8646,7 @@ __metadata: "@backstage/cli": "workspace:^" "@backstage/cli-common": "workspace:^" "@backstage/errors": "workspace:^" + "@backstage/types": "workspace:^" "@manypkg/get-packages": ^1.1.3 "@microsoft/api-documenter": ^7.19.27 "@microsoft/api-extractor": ^7.33.7