Merge pull request #8965 from backstage/rugvip/extractor

cli,catalog-model: add experimental type definitions with release stage split
This commit is contained in:
Patrik Oldsberg
2022-01-18 11:06:14 +01:00
committed by GitHub
22 changed files with 336 additions and 62 deletions
+9
View File
@@ -0,0 +1,9 @@
---
'@backstage/cli': patch
---
Introduced a new `--experimental-type-build` option to the various package build commands. This option switches the type definition build to be executed using API Extractor rather than a `rollup` plugin. In order for this experimental switch to work, you must also have `@microsoft/api-extractor` installed within your project, as it is an optional peer dependency.
The biggest difference between the existing mode and the experimental one is that rather than just building a single `dist/index.d.ts` file, API Extractor will output `index.d.ts`, `index.beta.d.ts`, and `index.alpha.d.ts`, all in the `dist` directory. 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`.
In addition, the `prepack` command now has support for `alphaTypes` and `betaTypes` fields in the `publishConfig` of `package.json`. These optional fields can be pointed to `dist/types.alpha.d.ts` and `dist/types.beta.d.ts` respectively, which will cause `<name>/alpha` and `<name>/beta` entry points to be generated for the package. See the [`@backstage/catalog-model`](https://github.com/backstage/backstage/blob/master/packages/catalog-model/package.json) package for an example of how this can be used in practice.
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-catalog': patch
'@backstage/plugin-catalog-backend': patch
---
Internal update to match status field changes in `@backstage/catalog-model`.
+21
View File
@@ -0,0 +1,21 @@
---
'@backstage/catalog-model': patch
---
Added `alpha` release stage type declarations, accessible via `@backstage/catalog-model/alpha`.
**BREAKING**: The experimental entity `status` field was removed from the base `Entity` type and is now only available on the `AlphaEntity` type from the alpha release stage, along with all accompanying types that were previously marked as `UNSTABLE_`.
For example, the following import:
```ts
import { UNSTABLE_EntityStatusItem } from '@backstage/catalog-model';
```
Becomes this:
```ts
import { EntityStatusItem } from '@backstage/catalog-model/alpha';
```
Note that exports that are only available from the alpha release stage are considered unstable and do not adhere to the semantic versioning of the package.