Merge branch 'master' of https://github.com/backstage/backstage into pr-draft

This commit is contained in:
Lykke Axlin
2021-10-15 14:54:59 +02:00
238 changed files with 4757 additions and 2475 deletions
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/create-app': patch
---
Removed the included `jest` configuration from the root `package.json` as the `transformModules` option no longer exists.
To apply this change to an existing app, make the follow change to the root `package.json`:
```diff
- "jest": {
- "transformModules": [
- "@asyncapi/react-component"
- ]
- }
```
-8
View File
@@ -1,8 +0,0 @@
---
'@backstage/plugin-auth-backend': patch
---
AWS-ALB: update provider to the latest changes described [here](https://backstage.io/docs/auth/identity-resolver).
This removes the `ExperimentalIdentityResolver` type in favor of `SignInResolver` and `AuthHandler`.
The AWS ALB provider can now be configured in the same way as the Google provider in the example.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
Fix a bug preventing an access token to be refreshed a second time with the GitHub provider.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-api-docs': patch
---
Bump `swagger-ui-react` to `^4.0.0-rc.3`.
-19
View File
@@ -1,19 +0,0 @@
---
'@backstage/create-app': patch
---
The scaffolder plugin has just released the beta 3 version of software templates, which replaces the handlebars templating syntax. As part of this change, the template entity schema is no longer included in the core catalog-model as with previous versions. The decoupling of the template entities version will allow us to more easily make updates in the future.
In order to use the new beta 3 templates, the following changes are **required** for any existing installation, inside `packages/backend/src/plugins/catalog.ts`:
```diff
+import { ScaffolderEntitiesProcessor } from '@backstage/plugin-scaffolder-backend';
...
const builder = await CatalogBuilder.create(env);
+ builder.addProcessor(new ScaffolderEntitiesProcessor());
const { processingEngine, router } = await builder.build();
```
If you're interested in learning more about creating custom kinds, please check out the [extending the model](https://backstage.io/docs/features/software-catalog/extending-the-model) documentation.
-7
View File
@@ -1,7 +0,0 @@
---
'@backstage/core-app-api': patch
'@backstage/core-components': patch
'@backstage/theme': patch
---
Internal refactor to avoid importing all of `@material-ui/core`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
update the null check to use the optional chaining operator in case of non-null assertion operator is not working in function extractInitials(values: string)
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-graphiql': patch
---
Add experimental `experimentalInstallationRecipe` to `package.json`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
Resolve a warning in `<Button>` related to not using `React.forwardRef`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
add a --from <location> option to the plugin install command
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog': patch
---
Support `material-ui` overrides in SystemDiagramCard and EmptityLinksEmptyState components
-15
View File
@@ -1,15 +0,0 @@
---
'@backstage/plugin-home': patch
---
Adds a `<WelcomeTitle>` component that shows a playful greeting on the home page.
To use it, pass it to the home page header:
```typescript
<Page themeId="home">
<Header title={<WelcomeTitle />} pageTitleOverride="Home">
<HomepageTimer />
</Header>
</Page>
```
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-api-docs': patch
---
Remove unused dependency on material-icons/font
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/core-components': minor
'@backstage/plugin-catalog-graph': minor
---
Add documentation and more type safety around DependencyGraph
-9
View File
@@ -1,9 +0,0 @@
---
'@backstage/plugin-catalog-backend': minor
---
This continues the deprecation of classes used by the legacy catalog engine. New deprecations can be viewed in this [PR](https://github.com/backstage/backstage/pull/7500) or in the API reference documentation.
The `batchAddOrUpdateEntities` method of the `EntitiesCatalog` interface has been marked as optional and is being deprecated. It is still implemented and required to be implemented by the legacy catalog classes, but was never implemented in the new catalog.
This change is only relevant if you are consuming the `EntitiesCatalog` interface directly, in which case you will get a type error that you need to resolve. It can otherwise be ignored.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fixes a bug in the catalog where entities were not being marked as orphaned.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
Fix search in Firefox. When the search was performed by pressing enter, the query parameter was first set but then reverted back.
-11
View File
@@ -1,11 +0,0 @@
---
'@backstage/core-components': patch
---
Change the Table search field placeholder to "Filter" and change icon accordingly
We had feedback that users expected the catalog table search field to have more sophisticated behaviour
than simple filtering. This change sets the search field placeholder to read "Filter"
to avoid confusion with the search feature. The icon is updated to match. This change is applied
generally in core-components so this change is made consistently across the app given the search
field is present on all pages via the sidebar.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Bump sucrase to version 3.20.2
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-api-docs': patch
---
Add actions props to the ApiExplorerPage
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-auth-backend': patch
---
Added extra configuration parameters for active directory file system identity
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Add semicolon in template to make prettier happy
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-azure-devops-backend': patch
---
Updates function for mapping RepoBuilds to handle undefined properties
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-code-coverage-backend': patch
---
check for existence of lines property in files
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-search': patch
---
SearchBar component to accept optional placeholder prop
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': minor
---
The syntax highlighting library used by the `CodeSnippet` component is now lazy loaded. This most likely has no effect on existing code, but may break tests as the content of the `CodeSnippet` is now rendered asynchronously.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog-backend': patch
---
This change refactors the internal package structure to remove the `next` catalog folder that was used during the implementation and testing phase of the new catalog engine. The implementation is now the default and is therefore restructured to no longer be packaged under `next/`. This refactor does not change catalog imports from other parts of the project.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Bump mini-css-extract-plugin to v2
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Update default backend ESLint configuration to allow usage of `__dirname` in tests.
-7
View File
@@ -1,7 +0,0 @@
---
'@backstage/cli': patch
---
Add an experimental `install <plugin>` command.
Given a `pluginId`, the command looks for NPM packages matching `@backstage/plugin-{pluginId}` or `backstage-plugin-{pluginId}` or `{pluginId}`. It looks for the `experimentalInstallationRecipe` in their `package.json` for the steps of installation. Detailed documentation and API Spec to follow (and to be decided as well).
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-azure-devops-backend': patch
---
Expands the Azure DevOps backend plugin to provide pull request data to be used by the front end plugin
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-home': patch
---
Fix `<ComponentTabs>` to display only the selected tab, not the other way around.
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/plugin-kubernetes-backend': patch
'@backstage/plugin-kubernetes': patch
---
Refactor kubernetes fetcher to reduce boilerplate code
-37
View File
@@ -1,37 +0,0 @@
---
'@backstage/plugin-home': patch
---
Added HeaderWorldClock to the Home plugin which is a copy of the HomepageTimer from core-components that has been updated to use props over static config from app-config.yaml. To use HeaderWorldClock you'll need to create an array of ClockConfig like this:
```ts
const clockConfigs: ClockConfig[] = [
{
label: 'NYC',
timeZone: 'America/New_York',
},
{
label: 'UTC',
timeZone: 'UTC',
},
{
label: 'STO',
timeZone: 'Europe/Stockholm',
},
{
label: 'TYO',
timeZone: 'Asia/Tokyo',
},
];
```
Then you can pass `clockConfigs` into the HeaderWorldClock like this:
```ts
<Page themeId="home">
<Header title="Home">
<HeaderWorldClock clockConfigs={clockConfigs} />
</Header>
<Content>...</Content>
</Page>
```
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/cli': minor
---
The Jest configuration that's included with the Backstage CLI has received several changes.
As a part of migrating to more widespread usage of ESM modules, the default configuration now transforms all source files everywhere, including those within `node_modules`. Due to this change the existing `transformModules` option has been removed and will be ignored. There is also a list of known packages that do not require transforms in the CLI, which will evolve over time. If needed there will also be an option to add packages to this list in the future, but it is not included yet to avoid clutter.
To counteract the slowdown of the additional transforms that have been introduced, the default configuration has also been reworked to enable caching across different packages. Previously each package in a Backstage monorepo would have its own isolated Jest cache, but it is now shared between packages that have a similar enough Jest configuration.
Another change that will speed up test execution is that the transformer for `.esm.js` files has been switched. It used to be an ESM transformer based on Babel, but it is also done by sucrase now since it is significantly faster.
The changes above are not strictly breaking as all tests should still work. It may however cause excessive slowdowns in projects that have configured custom transforms in the `jest` field within `package.json` files. In this case it is either best to consider removing the custom transforms, or overriding the `transformIgnorePatterns` to instead use Jest's default `'/node_modules/'` pattern.
This change also removes the `@backstage/cli/config/jestEsmTransform.js` transform, which can be replaced by using the `@backstage/cli/config/sucraseEsmTransform.js` transform instead.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog-react': patch
---
Support `material-ui` overrides in plugin-catalog-react components
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/plugin-catalog': patch
'@backstage/plugin-catalog-react': patch
---
added sorting in entity `Name` column by `metadata.title` if present
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
Deprecated HomepageTimer in favor of HeaderWorldClock which is found in the [home plugin](https://github.com/backstage/backstage/tree/master/plugins/home)
-25
View File
@@ -1,25 +0,0 @@
---
'@backstage/plugin-kubernetes-backend': patch
---
Enable customization of services used by the kubernetes backend plugin
The createRouter function has been deprecated in favor of a KubernetesBuilder object.
Here's how you should upgrade your projects when configuring the Kubernetes backend plugin.
in your `packages/backend/src/plugins/kubernetes.ts` file for instance:
```typescript
import { KubernetesBuilder } from '@backstage/plugin-kubernetes-backend';
import { PluginEnvironment } from '../types';
export default async function createPlugin({
logger,
config,
}: PluginEnvironment) {
const { router } = await KubernetesBuilder.createBuilder({
logger,
config,
}).build();
return router;
}
```
+2 -2
View File
@@ -140,7 +140,7 @@ jobs:
- name: test changed packages
if: ${{ steps.yarn-lock.outcome == 'success' }}
run: yarn lerna -- run test --since origin/master -- --coverage
run: yarn lerna -- run test --since origin/master -- --coverage --runInBand
env:
BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres9.ports[5432] }}
@@ -149,7 +149,7 @@ jobs:
- name: test all packages (and upload coverage)
if: ${{ steps.yarn-lock.outcome == 'failure' }}
run: |
yarn lerna -- run test -- --coverage
yarn lerna -- run test -- --coverage --runInBand
bash <(curl -s https://codecov.io/bash) -N $(git rev-parse FETCH_HEAD)
env:
BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }}
+1 -1
View File
@@ -58,7 +58,7 @@ jobs:
run: lerna run --scope @backstage/core-* build
- name: test
run: yarn lerna -- run test
run: yarn lerna -- run test --runInBand
env:
BACKSTAGE_TEST_DISABLE_DOCKER: 1
+1 -1
View File
@@ -116,7 +116,7 @@ jobs:
- name: test (and upload coverage)
run: |
yarn lerna -- run test -- --coverage
yarn lerna -- run test -- --coverage --runInBand
bash <(curl -s https://codecov.io/bash)
# Upload code coverage for some specific flags. Also see .codecov.yml
bash <(curl -s https://codecov.io/bash) -f packages/core-app-api/coverage/* -F core-app-api
+1
View File
@@ -57,3 +57,4 @@
| [Gelato](https://gelato.com/) | [Dmitry Makarenko](https://github.com/dmitry-makarenko-gelato) | Developer portal: documentation, service templates, org structure, service catalog, plugins for integration with internal and third-party systems🚀. |
| [GoCardless](https://gocardless.com/) | [James Turley](https://github.com/tragiclifestories) | Developer portal: documentation, service templates, org structure, service catalog, plugins for integration with internal systems. |
| [Box](https://www.box.com) | [@kielosz](https://github.com/kielosz), [@jluk-box](https://github.com/jluk-box), [@ptychu](https://github.com/ptychu), [@alexrybch](https://github.com/alexrybch), [@szubster](https://github.com/szubster) | Developer portal for service catalog, integration with internal systems, new service onboarding. |
| [Bazaarvoice](https://www.bazaarvoice.com) | [@niallmccullagh](https://github.com/niallmccullagh) | Developer portal for service catalog and scaffolds, publishing Github docs and API documentation, visualising our internal tech radar and our product engineering org structure. |
+4 -4
View File
@@ -113,10 +113,10 @@ search engines.
## Plugins Integrated with Search
| Plugin | Support Status |
| -------- | -------------- |
| Catalog | ✅ |
| TechDocs | ✅ |
| Plugin | Support Status |
| -------------------------------------------------------------- | -------------- |
| Catalog | ✅ |
| [TechDocs](./how-to-guides.md#how-to-index-techdocs-documents) | ✅ |
[Reach out to us](#get-involved) if you want to chat about support for more
plugins integrated to search.
+52
View File
@@ -44,3 +44,55 @@ const app = createApp({
],
});
```
## How to index TechDocs documents
The techdocs-plugin has supported integrations to Search, meaning that it
provides a default collator ready to be used.
The purpose of this how-to guide is to walk you through how to register the
[DefaultTechDocsCollator](https://github.com/backstage/backstage/blob/master/plugins/techdocs-backend/src/search/DefaultTechDocsCollator.ts)
in your App in two steps, so that you can get TechDocs documents indexed.
If you have been through the
[getting started guide](https://backstage.io/docs/features/search/getting-started)
already, you should have the `packages/backend/src/plugins/search.ts` file
available. If you have that, you can jump to the first step of this guide, if
not - start by go through the getting started guide.
1. Import the DefaultTechDocsCollator from `@backstage/plugin-techdocs-backend`.
```typescript
import { DefaultTechDocsCollator } from '@backstage/plugin-techdocs-backend';
```
2. Register the DefaultTechDocsCollator with the IndexBuilder.
```typescript
indexBuilder.addCollator({
defaultRefreshIntervalSeconds: 600,
collator: DefaultTechDocsCollator.fromConfig(config, {
discovery,
logger,
}),
});
```
You should now have your TechDocs documents indexed to your search engine of
choice!
If you want your users to be able to filter down to the techdocs type when
searching. You can update your `SearchPage.tsx` file in
`packages/app/src/components/search` by adding `techdocs` to the list of values
of the `SearchType` component.
```tsx
<Paper className={classes.filters}>
<SearchType
values={['techdocs', 'software-catalog']}
name="type"
defaultValue="software-catalog"
/>
...
</Paper>
```
@@ -620,9 +620,6 @@ The following describes the following entity kind:
| `apiVersion` | `backstage.io/v1beta2` |
| `kind` | `Template` |
If you're looking for docs on `v1alpha1` you can find them
[here](../software-templates/legacy.md)
A template definition describes both the parameters that are rendered in the
frontend part of the scaffolding wizard, and the steps that are executed when
scaffolding that component.
-117
View File
@@ -1,117 +0,0 @@
---
id: template-legacy
title: Writing Templates (Legacy)
# prettier-ignore
description: Old documentation describing the backstage.io/v1alpha1 format of the Template Schema
---
## Kind: Template
Describes the following entity kind:
| Field | Value |
| ------------ | ----------------------- |
| `apiVersion` | `backstage.io/v1alpha1` |
| `kind` | `Template` |
A Template describes a skeleton for use with the Scaffolder. It is used for
describing what templating library is supported, and also for documenting the
variables that the template requires using
[JSON Forms Schema](https://jsonforms.io/).
Descriptor files for this kind may look as follows.
```yaml
apiVersion: backstage.io/v1alpha1
kind: Template
metadata:
name: react-ssr-template
title: React SSR Template
description:
Next.js application skeleton for creating isomorphic web applications.
tags:
- recommended
- react
spec:
owner: web@example.com
templater: cookiecutter
type: website
path: '.'
schema:
required:
- component_id
- description
properties:
component_id:
title: Name
type: string
description: Unique name of the component
description:
title: Description
type: string
description: Description of the component
```
In addition to the [common envelope metadata](#common-to-all-kinds-the-metadata)
shape, this kind has the following structure.
### `apiVersion` and `kind` [required]
Exactly equal to `backstage.io/v1alpha1` and `Template`, respectively.
### `metadata.title` [required]
The nice display name for the template as a string, e.g. `React SSR Template`.
This field is required as is used to reference the template to the user instead
of the `metadata.name` field.
### `metadata.tags` [optional]
A list of strings that can be associated with the template, e.g.
`['recommended', 'react']`.
This list will also be used in the frontend to display to the user so you can
potentially search and group templates by these tags.
### `spec.type` [optional]
The type of component as a string, e.g. `website`. This field is optional but
recommended.
The software catalog accepts any type value, but an organization should take
great care to establish a proper taxonomy for these. Tools including Backstage
itself may read this field and behave differently depending on its value. For
example, a website type component may present tooling in the Backstage interface
that is specific to just websites.
The current set of well-known and common values for this field is:
- `service` - a backend service, typically exposing an API
- `website` - a website
- `library` - a software library, such as an npm module or a Java library
### `spec.templater` [required]
The templating library that is supported by the template skeleton as a string,
e.g `cookiecutter`.
Different skeletons will use different templating syntax, so it's common that
the template will need to be run with a particular piece of software.
This key will be used to identify the correct templater which is registered into
the `TemplatersBuilder`.
The values which are available by default are:
- `cookiecutter` - [cookiecutter](https://github.com/cookiecutter/cookiecutter).
### `spec.path` [optional]
The string location where the templater should be run if it is not on the same
level as the `template.yaml` definition, e.g. `./cookiecutter/skeleton`.
This will set the `cwd` when running the templater to the folder path that you
specify relative to the `template.yaml` definition.
This is also particularly useful when you have multiple template definitions in
the same repository but only a single `template.yaml` registered in backstage.
@@ -1,333 +0,0 @@
---
id: migrating-from-v1alpha1-to-v1beta2
title: Migrating to v1beta2 templates
# prettier-ignore
description: How to move your old templates from v1alpha1 to the more declarative v1beta2
---
# What's new?
Previously, the scaffolder was very restricted in what you could do when
creating new software components from templates. There were three scaffolding
steps which was pretty hard to extend and add new functionality to, difficult to
re-use logic between templates. There used to be a fixed pipeline of
`preparers`, `templaters`, and `publishers`, which were defined by the backend
and needed to be run for each template. This is now changed, to give the
template total control over what should be executed as part of the templating
run. This makes templates a little more declarative as you can now register
different `actions` or `functions` with the `scaffolder-backend` which you then
can decide how, and in what order, to run using the template definition YAML
file.
We've also made some improvements, and added some helpers to work with
cookiecutter. The skeleton for a template can now be stored in a different place
to where your entity definition is: previously you needed to have your
`template.yaml` next to the skeleton source (`{{cookiecutter.component_id}}`
directory), but now that's not the case. Part of the changes with the `v1beta2`
syntax is that you can grab your template source from any repository, and re-use
them between templates.
We've also renamed the `schema` property to `parameters` as this makes more
sense when using them as parameters to the actions or steps that you've setup
for your templates. There's the added benefit that you can now assign an array
to the `parameters` property, which will then give you multiple steps in the UI,
so you can split apart your input parameters and group them as needed rather
than having one long list of input fields.
## The `parameters` property
The `schema` key has now been renamed to `parameters` with a few more features.
You can pass an array now to break apart the input form into different steps in
the UI. You can also specify `ui:schema` fields that are passed along to
[`react-jsonschema-form`](https://rjsf-team.github.io/react-jsonschema-form/)
inline with the JSON schema.
```yaml
spec:
parameters:
- title: Fill in some steps
required:
- name
properties:
name:
title: Name
type: string
description: Unique name of the component
ui:autofocus: true
ui:options:
rows: 5
```
## The `steps` property
`v1beta2` template syntax introduces the new `steps` property, which is an array
of `actions` that the scaffolder will run in combination with the user input
that is declared in the `schema`. Actions look like the following:
```yaml
spec:
steps:
- id: publish # a unique id for the step, can be anything you like
name: Publish # a user friendly name for the step, this is what is shown in the frontend
action: publish:github # the action ID that has been registered with the scaffolder-backend
input: # parameters that are passed as input to the action handler function
allowedHosts: ['github.com']
description: 'This is {{ parameters.name }}' # handlebars templating is supported with the values from the parameters section in the same file.
repoUrl: '{{ parameters.repoUrl }}'
```
# Migrating a `v1alpha1` template
## The template definition (.yaml)
### `parameters`
Because of the changes to invert the control to the `template.yaml` definition
for running the workflow, we need to adjust the `schema` property and we also
now need to define what the template is actually going to do as part of the
template run.
A simple migration would move the following yaml:
```yaml
apiVersion: backstage.io/v1alpha1
kind: Template
metadata:
name: react-ssr-template
title: React SSR Template
description: Create a website powered with Next.js
tags:
- recommended
- react
spec:
owner: web@example.com
templater: cookiecutter
type: website
path: '.'
schema:
required:
- component_id
- description
properties:
component_id:
title: Name
type: string
description: Unique name of the component
description:
title: Description
type: string
description: Help others understand what this website is for.
```
To something that looks like the following:
```yaml
apiVersion: backstage.io/v1beta2
kind: Template
metadata:
name: react-ssr-template
title: React SSR Template
description: Create a website powered with Next.js
tags:
- recommended
- react
spec:
owner: web@example.com
type: website
parameters:
- title: Add some input
required:
- component_id
- description
properties:
component_id:
title: Name
type: string
description: Unique name of the component
description:
title: Description
type: string
description: Help others understand what this website is for.
- title: Some more additional info that was previously provided automatically
required:
- owner
- repoUrl
properties:
owner:
title: Owner
type: string
description: Owner of the component
ui:field: OwnerPicker
ui:options:
allowedKinds:
- Group
- title: Choose a location
repoUrl:
title: Repository Location
type: string
ui:field: RepoUrlPicker
ui:options:
allowedHosts:
- github.com
```
There are a few things to note here. On the `alpha` version, the second step of
the template flow in the frontend was provided by Backstage for free, so we used
to collect the user input for the `owner` field and the `repositoryUrl` that you
were going to publish to. Now because `actions` can have any workflow they like,
it doesn't make sense to still provide these fields for every scaffolding
workflow, as you might not need these anymore. That's why we now manually add
those fields back into the template parameters that are shown to the user:
```yaml
- title: Some more additional info that was previously provided automatically
required:
- owner
- repoUrl
properties:
owner:
title: Owner
type: string
description: Owner of the component
ui:field: OwnerPicker
ui:options:
allowedKinds:
- Group
- title: Choose a location
repoUrl:
title: Repository Location
type: string
ui:field: RepoUrlPicker
ui:options:
allowedHosts:
- github.com
```
Maybe you also don't need to publish to `github.com`, you should replace this
with your VCS provider URL that is listed in your `integrations` config instead.
### `steps`
So now we should have all the required information that we need from the user in
a much more extensible way. We now need to tell the scaffolder what to do with
these parameters and what to do with the user input.
We've made templating using `cookiecutter` a little simpler. You don't need to
store the `cookiecutter` skeleton in the same directory as the `template.yaml`
definition, it can live wherever you like - maybe a shared repository somewhere
so you can re-use the skeletons but apply different actions for different
templates depending on your use case.
We also no longer need to have a directory called
`{{cookiecutter.component_id}}`. This is because now we can't ensure that
`component_id` will be a parameter that is provided from the frontend, this
could break `cookiecutter`. If your directory structure used to look like this:
```
my-awesome-template
-> {{cookiecutter.component_id}}
-> file.txt
-> some_more_files.ts
-> hooks
-> post_gen_project.sh
-> template.yaml
```
We now recommend that you move to the following structure:
```
my-awesome-template
-> skeleton
-> file.txt
-> some_more_files.ts
-> template.yaml
```
This migration renames the skeleton folder to something more semantic, and also
drops support for `cookiecutter` hooks. We've dropped support for `cookiecutter`
hooks for now, as hopefully everything that is stored in these hooks can be
moved to `actions` instead, and for security reasons, it's more secure to run
trusted code that you ship with Backstage as an action rather than some script
that can be pulled in from anywhere which doesn't get vetted first. It's a
pretty big security risk that those scripts will be run on Backstage instances
inside your infrastructure, especially `.sh` files.
If you really need hooks and can't find a suitable solution by using actions
please reach out to us through a ticket and we'll see what we can do to assist
:)
You'll notice that we removed the `templater` property from the `spec`
definition in the template `yaml`, so there's no way to define that this is a
`cookiecutter` `templater`.
We've created a built-in action that you can use which will when run, go grab a
directory from anywhere and run `cookiecutter` on top of it, and then extract
the contents into the working directory for the scaffolder.
Adding the `steps` for a simple template should look something like the
following:
```yaml
spec:
steps:
# this action will go use cookiecutter to template some files into the working directory
- id: template # an ID for the templating step
name: Create skeleton # A user friendly name for the action
action: fetch:cookiecutter
input:
url: ./skeleton # this is the directory for your skeleton files.
# If it's located next to the `template.yaml` then you can use a relative path,
# otherwise you can use absolute URLs that point at the VCS: https://github.com/backstage/backstage/tree/master/some_folder_somewhere
values:
# for each value that you need to pass to cookiecutter, they should be listed here and set in this values object.
# You can use the handlebars templating syntax to pull them from the input parameters listed in the same file
name: '{{ parameters.name }}'
owner: '{{ parameters.owner }}'
destination: '{{ parseRepoUrl parameters.repoUrl }}'
# this action is for publishing the working directory to the VCS
- id: publish
name: Publish
action: publish:github
input:
allowedHosts: ['github.com']
description: 'This is {{ parameters.name }}'
repoUrl: '{{ parameters.repoUrl }}'
# this action will then register the created component in Backstage
- id: register
name: Register
action: catalog:register
input:
repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}'
catalogInfoPath: '/catalog-info.yaml'
```
### `output`
Steps can output values, and so can the template itself. This is good for
returning values to the frontend, so we can make the buttons like
`Go to catalog` and `Go to repo` work correctly. You can add the following to
your `template.yaml` to make sure you return the right values from the steps:
```yaml
spec:
output:
remoteUrl: '{{ steps.publish.output.remoteUrl }}'
entityRef: '{{ steps.register.output.entityRef }}'
```
Or you can return a `links` array with text and a URL explicitly:
```yaml
spec:
output:
links:
- url: '{{steps.publish.output.remoteUrl}}'
title: 'Go to Repo'
```
## Questions?
If you have any questions or feedback, please reach out to us on GitHub or
Discord and we will do our best to help!
@@ -0,0 +1,156 @@
---
id: migrating-from-v1beta2-to-v1beta3
title: Migrating to v1beta3 templates
# prettier-ignore
description: How to migrate your existing templates to beta3 syntax
---
# What's new?
Well then, here we are! 🚀
Backstage has had many forms of templating languages throughout different
plugins and different systems. We've had `cookiecutter` syntax in templates, and
we also had `handlebars` templating in the `kind: Template`. Then we wanted to
remove the additional dependency on `cookiecutter` for Software Templates out of
the box, so we introduced `nunjucks` as an alternative in `fetch:template`
action which is based on the `jinja2` syntax so they're pretty similar. In an
effort to reduce confusion and unify on to one templating language, we're
officially deprecating support for `handlebars` templating in the
`kind: Template` entities with `apiVersion` `scaffolder.backstage.io/v1beta3`
and moving to using `nunjucks` instead.
This provides us a lot of built in `filters` (`handlebars` helpers), that as
Template authors will give you much more flexibility out of the box, and also
open up sharing of filters in the Entity and the actual `skeleton` too, and
removing the slight differences between the two languages.
We've also removed a lot of the built in helpers that we shipped with
`handlebars`, as they're now supported as first class citizens by either
`nunjucks` or the new `scaffolder` when using `scaffolder.backstage.io/v1beta3`
`apiVersion`
The migration path is pretty simple, and we've removed some of the pain points
from writing the `handlebars` templates too. Let's go through what's new and how
to upgrade.
## `backstage.io/v1beta2` -> `scaffolder.backstage.io/v1beta3`
The most important change is that you'll need to switch over the `apiVersion` in
your templates to the new one.
```diff
kind: Template
- apiVersion: backstage.io/v1beta2
+ apiVersion: scaffolder.backstage.io/v1beta3
```
## `${{ }}` instead of `"{{ }}"`
One really big readability issue and cause for confusion was the fact that with
`handlebars` and `yaml` you always had to wrap your templating strings in quotes
in `yaml` so that it didn't try to parse it as a `json` object and fail. This
was pretty annoying, as it also meant that all things look like strings. Now
that's no longer the case, you can now remove the `""` and take advantage of
writing nice `yaml` files that just work.
```diff
spec:
steps:
input:
allowedHosts: ['github.com']
- description: 'This is {{ parameters.name }}'
+ description: This is ${{ parameters.name }}
- repoUrl: '{{ parameters.repoUrl }}'
+ repoUrl: ${{ parameters.repoUrl }}
```
## No more `eq` or `not` helpers
These helpers are no longer needed with the more expressive `api` that
`nunjucks` provides. You can simply use the built-in `nunjucks` and `jinja2`
style operators.
```diff
spec:
steps:
input:
- if: '{{ eq parameters.value "backstage" }}'
+ if: ${{ parameters.value === "backstage" }}
...
```
And then for the `not`
```diff
spec:
steps:
input:
- if: '{{ not parameters.value "backstage" }}'
+ if: ${{ parameters.value !== "backstage" }}
...
```
Much better right? ✨
## No more `json` helper
This helper is no longer needed, as we've added support for complex values and
supporting the additional primitive values now rather than everything being a
`string`. This means that now that you can pass around `parameters` and it
should all work as expected and keep the type that has been declared in the
input schema.
```diff
spec:
parameters:
test:
type: number
name: Test Number
address:
type: object
required:
- line1
properties:
line1:🙏
type: string
name: Line 1
line2:
type: string
name: Line 2
steps:
- id: test step
action: run:something
input:
- address: '{{ json parameters.address }}'
+ address: ${{ parameters.address }}
- number: '{{ parameters.number }}'
+ number: ${{ parameters.number }} # this will now make sure that the type of number is a number 🙏
```
## `parseRepoUrl` is now a `filter`
All calls to `parseRepoUrl` are now a `jinja2` `filter`, which means you'll need
to update the syntax.
```diff
spec:
steps:
input:
- repoUrl: '{{ parseRepoUrl parameters.repoUrl }}'
+ repoUrl: ${{ parameters.repoUrl | parseRepoUrl }}
...
```
Now we have complex value support here too, expect that this `filter` will go
away in future versions and the `RepoUrlPicker` will return an object so
`parameters.repoUrl` will already be a
`{ host: string; owner: string; repo: string }` 🚀
### Summary
Of course, we're always available on [discord](https://discord.gg/MUpMjP2) if
you're stuck or something's not working as expected. You can also
[raise an issue](https://github.com/backstage/backstage/issues/new/choose) with
feedback or bugs!
+1 -2
View File
@@ -78,8 +78,7 @@
"features/software-templates/builtin-actions",
"features/software-templates/writing-custom-actions",
"features/software-templates/writing-custom-field-extensions",
"features/software-templates/template-legacy",
"features/software-templates/migrating-from-v1alpha1-to-v1beta2"
"features/software-templates/migrating-from-v1beta2-to-v1beta3"
]
},
{
-5
View File
@@ -85,10 +85,5 @@
"*.md": [
"node ./scripts/check-docs-quality"
]
},
"jest": {
"transformModules": [
"@asyncapi/react-component"
]
}
}
+43
View File
@@ -1,5 +1,48 @@
# example-app
## 0.2.50
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/plugin-catalog@0.7.1
- @backstage/plugin-api-docs@0.6.12
- @backstage/plugin-scaffolder@0.11.8
- @backstage/core-app-api@0.1.17
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
- @backstage/plugin-graphiql@0.2.20
- @backstage/cli@0.7.16
- @backstage/plugin-home@0.4.4
- @backstage/plugin-catalog-graph@0.2.0
- @backstage/plugin-search@0.4.15
- @backstage/plugin-techdocs@0.12.2
- @backstage/plugin-kubernetes@0.4.17
- @backstage/plugin-azure-devops@0.1.1
- @backstage/plugin-badges@0.2.13
- @backstage/plugin-catalog-import@0.7.2
- @backstage/plugin-circleci@0.2.27
- @backstage/plugin-cloudbuild@0.2.27
- @backstage/plugin-code-coverage@0.1.15
- @backstage/plugin-explore@0.3.20
- @backstage/plugin-github-actions@0.4.22
- @backstage/plugin-jenkins@0.5.10
- @backstage/plugin-kafka@0.2.19
- @backstage/plugin-lighthouse@0.2.29
- @backstage/plugin-org@0.3.27
- @backstage/plugin-pagerduty@0.3.17
- @backstage/plugin-rollbar@0.3.18
- @backstage/plugin-sentry@0.3.25
- @backstage/plugin-todo@0.1.14
- @backstage/integration-react@0.1.12
- @backstage/plugin-cost-insights@0.11.10
- @backstage/plugin-gcp-projects@0.3.8
- @backstage/plugin-newrelic@0.3.8
- @backstage/plugin-shortcuts@0.1.12
- @backstage/plugin-tech-radar@0.4.11
- @backstage/plugin-user-settings@0.3.9
## 0.2.49
### Patch Changes
+39 -39
View File
@@ -1,49 +1,49 @@
{
"name": "example-app",
"version": "0.2.49",
"version": "0.2.50",
"private": true,
"bundled": true,
"dependencies": {
"@backstage/catalog-model": "^0.9.4",
"@backstage/cli": "^0.7.15",
"@backstage/core-app-api": "^0.1.16",
"@backstage/core-components": "^0.6.1",
"@backstage/cli": "^0.7.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/integration-react": "^0.1.11",
"@backstage/plugin-api-docs": "^0.6.11",
"@backstage/plugin-azure-devops": "^0.1.0",
"@backstage/plugin-badges": "^0.2.12",
"@backstage/plugin-catalog": "^0.7.0",
"@backstage/plugin-catalog-graph": "^0.1.3",
"@backstage/plugin-catalog-import": "^0.7.1",
"@backstage/plugin-catalog-react": "^0.5.2",
"@backstage/plugin-circleci": "^0.2.26",
"@backstage/plugin-cloudbuild": "^0.2.26",
"@backstage/plugin-code-coverage": "^0.1.14",
"@backstage/plugin-cost-insights": "^0.11.9",
"@backstage/plugin-explore": "^0.3.19",
"@backstage/plugin-gcp-projects": "^0.3.7",
"@backstage/plugin-github-actions": "^0.4.21",
"@backstage/plugin-graphiql": "^0.2.19",
"@backstage/plugin-home": "^0.4.3",
"@backstage/plugin-jenkins": "^0.5.9",
"@backstage/plugin-kafka": "^0.2.18",
"@backstage/plugin-kubernetes": "^0.4.16",
"@backstage/plugin-lighthouse": "^0.2.28",
"@backstage/plugin-newrelic": "^0.3.7",
"@backstage/plugin-org": "^0.3.26",
"@backstage/plugin-pagerduty": "0.3.16",
"@backstage/plugin-rollbar": "^0.3.17",
"@backstage/plugin-scaffolder": "^0.11.7",
"@backstage/plugin-search": "^0.4.14",
"@backstage/plugin-sentry": "^0.3.24",
"@backstage/plugin-shortcuts": "^0.1.11",
"@backstage/plugin-tech-radar": "^0.4.10",
"@backstage/plugin-techdocs": "^0.12.1",
"@backstage/plugin-todo": "^0.1.13",
"@backstage/plugin-user-settings": "^0.3.8",
"@backstage/integration-react": "^0.1.12",
"@backstage/plugin-api-docs": "^0.6.12",
"@backstage/plugin-azure-devops": "^0.1.1",
"@backstage/plugin-badges": "^0.2.13",
"@backstage/plugin-catalog": "^0.7.1",
"@backstage/plugin-catalog-graph": "^0.2.0",
"@backstage/plugin-catalog-import": "^0.7.2",
"@backstage/plugin-catalog-react": "^0.6.0",
"@backstage/plugin-circleci": "^0.2.27",
"@backstage/plugin-cloudbuild": "^0.2.27",
"@backstage/plugin-code-coverage": "^0.1.15",
"@backstage/plugin-cost-insights": "^0.11.10",
"@backstage/plugin-explore": "^0.3.20",
"@backstage/plugin-gcp-projects": "^0.3.8",
"@backstage/plugin-github-actions": "^0.4.22",
"@backstage/plugin-graphiql": "^0.2.20",
"@backstage/plugin-home": "^0.4.4",
"@backstage/plugin-jenkins": "^0.5.10",
"@backstage/plugin-kafka": "^0.2.19",
"@backstage/plugin-kubernetes": "^0.4.17",
"@backstage/plugin-lighthouse": "^0.2.29",
"@backstage/plugin-newrelic": "^0.3.8",
"@backstage/plugin-org": "^0.3.27",
"@backstage/plugin-pagerduty": "0.3.17",
"@backstage/plugin-rollbar": "^0.3.18",
"@backstage/plugin-scaffolder": "^0.11.8",
"@backstage/plugin-search": "^0.4.15",
"@backstage/plugin-sentry": "^0.3.25",
"@backstage/plugin-shortcuts": "^0.1.12",
"@backstage/plugin-tech-radar": "^0.4.11",
"@backstage/plugin-techdocs": "^0.12.2",
"@backstage/plugin-todo": "^0.1.14",
"@backstage/plugin-user-settings": "^0.3.9",
"@backstage/search-common": "^0.2.0",
"@backstage/theme": "^0.2.10",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -63,7 +63,7 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/test-utils": "^0.1.18",
"@backstage/test-utils": "^0.1.19",
"@rjsf/core": "^3.0.0",
"@testing-library/cypress": "^7.0.1",
"@testing-library/jest-dom": "^5.10.1",
@@ -14,13 +14,17 @@
* limitations under the License.
*/
import React from 'react';
import { EntityLayout } from '@backstage/plugin-catalog';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { renderInTestApp } from '@backstage/test-utils';
import { cicdContent } from './EntityPage';
import { githubActionsApiRef } from '@backstage/plugin-github-actions';
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
import { EntityLayout } from '@backstage/plugin-catalog';
import {
DefaultStarredEntitiesApi,
EntityProvider,
starredEntitiesApiRef,
} from '@backstage/plugin-catalog-react';
import { githubActionsApiRef } from '@backstage/plugin-github-actions';
import { MockStorageApi, renderInTestApp } from '@backstage/test-utils';
import React from 'react';
import { cicdContent } from './EntityPage';
describe('EntityPage Test', () => {
const entity = {
@@ -48,7 +52,10 @@ describe('EntityPage Test', () => {
downloadJobLogsForWorkflowRun: jest.fn(),
} as jest.Mocked<typeof githubActionsApiRef.T>;
const apis = ApiRegistry.with(githubActionsApiRef, mockedApi);
const apis = ApiRegistry.with(githubActionsApiRef, mockedApi).with(
starredEntitiesApiRef,
new DefaultStarredEntitiesApi({ storageApi: MockStorageApi.create() }),
);
describe('cicdContent', () => {
it('Should render GitHub Actions View', async () => {
+14
View File
@@ -1,5 +1,19 @@
# example-backend
## 0.2.50
### Patch Changes
- Updated dependencies
- @backstage/plugin-auth-backend@0.4.4
- @backstage/integration@0.6.8
- @backstage/plugin-scaffolder-backend@0.15.8
- @backstage/plugin-catalog-backend@0.17.0
- @backstage/plugin-azure-devops-backend@0.1.2
- @backstage/plugin-code-coverage-backend@0.1.13
- @backstage/plugin-kubernetes-backend@0.3.17
- example-app@0.2.50
## 0.2.49
### Patch Changes
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "example-backend",
"version": "0.2.49",
"version": "0.2.50",
"main": "dist/index.cjs.js",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -28,20 +28,20 @@
"@backstage/catalog-client": "^0.5.0",
"@backstage/catalog-model": "^0.9.4",
"@backstage/config": "^0.1.10",
"@backstage/integration": "^0.6.7",
"@backstage/integration": "^0.6.8",
"@backstage/plugin-app-backend": "^0.3.16",
"@backstage/plugin-auth-backend": "^0.4.3",
"@backstage/plugin-azure-devops-backend": "^0.1.1",
"@backstage/plugin-auth-backend": "^0.4.4",
"@backstage/plugin-azure-devops-backend": "^0.1.2",
"@backstage/plugin-badges-backend": "^0.1.11",
"@backstage/plugin-catalog-backend": "^0.16.0",
"@backstage/plugin-code-coverage-backend": "^0.1.12",
"@backstage/plugin-catalog-backend": "^0.17.0",
"@backstage/plugin-code-coverage-backend": "^0.1.13",
"@backstage/plugin-graphql-backend": "^0.1.9",
"@backstage/plugin-jenkins-backend": "^0.1.6",
"@backstage/plugin-kubernetes-backend": "^0.3.16",
"@backstage/plugin-kubernetes-backend": "^0.3.17",
"@backstage/plugin-kafka-backend": "^0.2.10",
"@backstage/plugin-proxy-backend": "^0.2.13",
"@backstage/plugin-rollbar-backend": "^0.1.15",
"@backstage/plugin-scaffolder-backend": "^0.15.7",
"@backstage/plugin-scaffolder-backend": "^0.15.8",
"@backstage/plugin-scaffolder-backend-module-rails": "^0.1.5",
"@backstage/plugin-search-backend": "^0.2.6",
"@backstage/plugin-search-backend-node": "^0.4.2",
@@ -53,7 +53,7 @@
"@octokit/rest": "^18.5.3",
"azure-devops-node-api": "^11.0.1",
"dockerode": "^3.2.1",
"example-app": "^0.2.49",
"example-app": "^0.2.50",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"express-prom-bundle": "^6.3.6",
@@ -65,7 +65,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/cli": "^0.7.16",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5"
+13
View File
@@ -1,5 +1,18 @@
# @backstage/cli
## 0.7.16
### Patch Changes
- 53bdc66623: add a --from <location> option to the plugin install command
- 84e24fcdaf: Bump sucrase to version 3.20.2
- 6583c6ac40: Add semicolon in template to make prettier happy
- c6f927d819: Bump mini-css-extract-plugin to v2
- 16f044cb6b: Update default backend ESLint configuration to allow usage of `__dirname` in tests.
- 1ef9e64901: Add an experimental `install <plugin>` command.
Given a `pluginId`, the command looks for NPM packages matching `@backstage/plugin-{pluginId}` or `backstage-plugin-{pluginId}` or `{pluginId}`. It looks for the `experimentalInstallationRecipe` in their `package.json` for the steps of installation. Detailed documentation and API Spec to follow (and to be decided as well).
## 0.7.15
### Patch Changes
+42 -14
View File
@@ -16,7 +16,25 @@
const fs = require('fs-extra');
const path = require('path');
const crypto = require('crypto');
const glob = require('util').promisify(require('glob'));
const { version } = require('../package.json');
const transformIgnorePattern = [
'@material-ui',
'@rjsf',
'ajv',
'core-js',
'jest-.*',
'jsdom',
'knex',
'react',
'react-dom',
'highlight\\.js',
'prismjs',
'react-use',
'typescript',
].join('|');
async function getProjectConfig(targetPath, displayName) {
const configJsPath = path.resolve(targetPath, 'jest.config.js');
@@ -58,10 +76,7 @@ async function getProjectConfig(targetPath, displayName) {
currentPath = newPath;
}
// We add an additional Jest config parameter only known by the Backstage CLI
// called `transformModules`. It's a list of modules that we want to apply
// our configured jest transformations for.
// This is useful when packages are published in untranspiled ESM or TS form.
// This is an old deprecated option that is no longer used.
const transformModules = pkgJsonConfigs
.flatMap(conf => {
const modules = conf.transformModules || [];
@@ -70,10 +85,14 @@ async function getProjectConfig(targetPath, displayName) {
})
.map(name => `${name}/`)
.join('|');
const transformModulePattern = transformModules && `(?!${transformModules})`;
if (transformModules.length > 0) {
console.warn(
'The Backstage CLI jest transformModules option is no longer used and will be ignored. All modules are now always transformed.',
);
}
const options = {
displayName,
...(displayName && { displayName }),
rootDir: path.resolve(targetPath, 'src'),
coverageDirectory: path.resolve(targetPath, 'coverage'),
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/*.d.ts'],
@@ -82,8 +101,7 @@ async function getProjectConfig(targetPath, displayName) {
},
transform: {
'\\.esm\\.js$': require.resolve('./jestEsmTransform.js'), // See jestEsmTransform.js
'\\.(js|jsx|ts|tsx)$': require.resolve('@sucrase/jest-plugin'),
'\\.(js|jsx|ts|tsx)$': require.resolve('./jestSucraseTransform.js'),
'\\.(bmp|gif|jpg|jpeg|png|frag|xml|svg|eot|woff|woff2|ttf)$':
require.resolve('./jestFileTransform.js'),
'\\.(yaml)$': require.resolve('jest-transform-yaml'),
@@ -92,11 +110,7 @@ async function getProjectConfig(targetPath, displayName) {
// A bit more opinionated
testMatch: ['**/?(*.)test.{js,jsx,mjs,ts,tsx}'],
// Default behaviour is to not apply transforms for node_modules, but we still want
// to apply the esm-transformer to .esm.js files, since that's what we use in backstage packages.
transformIgnorePatterns: [
`/node_modules/${transformModulePattern}.*\\.(?:(?<!esm\\.)js|json)$`,
],
transformIgnorePatterns: [`/node_modules/(?:${transformIgnorePattern})/`],
};
// Use src/setupTests.ts as the default location for configuring test env
@@ -104,7 +118,21 @@ async function getProjectConfig(targetPath, displayName) {
options.setupFilesAfterEnv = ['<rootDir>/setupTests.ts'];
}
return Object.assign(options, ...pkgJsonConfigs);
const config = Object.assign(options, ...pkgJsonConfigs);
// The config name is a cache key that lets us share the jest cache across projects.
// If no explicit name was configured, generated one based on the configuration.
if (!config.name) {
const configHash = crypto
.createHash('md5')
.update(version)
.update(Buffer.alloc(1))
.update(JSON.stringify(config.transform))
.digest('hex');
config.name = `backstage_cli_${configHash}`;
}
return config;
}
// This loads the root jest config, which in turn will either refer to a single
-36
View File
@@ -1,36 +0,0 @@
/*
* 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.
*/
const babel = require('@babel/core');
// We build .esm.js files with plugin:build, so to be able to load these in tests they need to be transformed
// TODO: jest is working on module support, it's possible that we can remove this in the future
module.exports = {
process(src) {
const result = babel.transform(src, {
babelrc: false,
compact: false,
plugins: [
// This transforms the regular ESM syntax, import and export statements
require.resolve('@babel/plugin-transform-modules-commonjs'),
// This transforms dynamic `import()`, which is not supported yet in the Node.js VM API
require.resolve('babel-plugin-dynamic-import-node'),
],
});
return result.code;
},
};
@@ -0,0 +1,66 @@
/*
* Copyright 2021 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.
*/
const { createHash } = require('crypto');
const { transform } = require('sucrase');
const sucrasePkg = require('sucrase/package.json');
const sucrasePluginPkg = require('@sucrase/jest-plugin/package.json');
const ESM_REGEX = /\b(?:import|export)\b/;
function process(source, filePath) {
let transforms;
if (filePath.endsWith('.esm.js')) {
transforms = ['imports'];
} else if (filePath.endsWith('.js')) {
// This is a very rough filter to avoid transforming things that we quickly
// can be sure are definitely not ESM modules.
if (ESM_REGEX.test(source)) {
transforms = ['imports', 'jsx']; // JSX within .js is currently allowed
}
} else if (filePath.endsWith('.jsx')) {
transforms = ['jsx', 'imports'];
} else if (filePath.endsWith('.ts')) {
transforms = ['typescript', 'imports'];
} else if (filePath.endsWith('.tsx')) {
transforms = ['typescript', 'jsx', 'imports'];
}
// Only apply the jest transform to the test files themselves
if (transforms && filePath.includes('.test.')) {
transforms.push('jest');
}
if (transforms) {
return transform(source, { transforms, filePath }).code;
}
return source;
}
// TODO: contribute something like this to @sucrase/jest-plugin
function getCacheKey(sourceText) {
return createHash('md5')
.update(sourceText)
.update(Buffer.alloc(1))
.update(sucrasePkg.version)
.update(Buffer.alloc(1))
.update(sucrasePluginPkg.version)
.digest('hex');
}
module.exports = { process, getCacheKey };
+6 -9
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli",
"description": "CLI for developing Backstage plugins and apps",
"version": "0.7.15",
"version": "0.7.16",
"private": false,
"publishConfig": {
"access": "public"
@@ -28,8 +28,6 @@
"backstage-cli": "bin/backstage-cli"
},
"dependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@backstage/cli-common": "^0.1.4",
"@backstage/config": "^0.1.10",
"@backstage/config-loader": "^0.6.10",
@@ -54,7 +52,6 @@
"@typescript-eslint/eslint-plugin": "^v4.30.0",
"@typescript-eslint/parser": "^v4.28.3",
"@yarnpkg/lockfile": "^1.1.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"bfj": "^7.0.2",
"buffer": "^6.0.3",
"chalk": "^4.0.0",
@@ -120,12 +117,12 @@
"devDependencies": {
"@backstage/backend-common": "^0.9.6",
"@backstage/config": "^0.1.10",
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/core-app-api": "^0.1.16",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.18",
"@backstage/theme": "^0.2.10",
"@backstage/core-app-api": "^0.1.17",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@backstage/theme": "^0.2.11",
"@types/diff": "^5.0.0",
"@types/express": "^4.17.6",
"@types/fs-extra": "^9.0.1",
+8
View File
@@ -1,5 +1,13 @@
# @backstage/codemods
## 0.1.18
### Patch Changes
- Updated dependencies
- @backstage/core-app-api@0.1.17
- @backstage/core-components@0.7.0
## 0.1.17
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/codemods",
"description": "A collection of codemods for Backstage projects",
"version": "0.1.17",
"version": "0.1.18",
"private": false,
"publishConfig": {
"access": "public",
+9
View File
@@ -1,5 +1,14 @@
# @backstage/core-app-api
## 0.1.17
### Patch Changes
- 75bc878221: Internal refactor to avoid importing all of `@material-ui/core`.
- Updated dependencies
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
## 0.1.16
### Patch Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-app-api",
"description": "Core app API used by Backstage apps",
"version": "0.1.16",
"version": "0.1.17",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,10 +29,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/config": "^0.1.10",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/theme": "^0.2.10",
"@backstage/theme": "^0.2.11",
"@backstage/version-bridge": "^0.1.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -45,8 +45,8 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.7.16",
"@backstage/test-utils": "^0.1.19",
"@backstage/test-utils-core": "^0.1.3",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
+25
View File
@@ -1,5 +1,30 @@
# @backstage/core-components
## 0.7.0
### Minor Changes
- 5c42360577: Add documentation and more type safety around DependencyGraph
- a20cbf00d2: The syntax highlighting library used by the `CodeSnippet` component is now lazy loaded. This most likely has no effect on existing code, but may break tests as the content of the `CodeSnippet` is now rendered asynchronously.
### Patch Changes
- 75bc878221: Internal refactor to avoid importing all of `@material-ui/core`.
- 6ec56d5a57: update the null check to use the optional chaining operator in case of non-null assertion operator is not working in function extractInitials(values: string)
- 81c2a1af86: Resolve a warning in `<Button>` related to not using `React.forwardRef`.
- 53470ada54: Fix search in Firefox. When the search was performed by pressing enter, the query parameter was first set but then reverted back.
- b488d8b69f: Change the Table search field placeholder to "Filter" and change icon accordingly
We had feedback that users expected the catalog table search field to have more sophisticated behaviour
than simple filtering. This change sets the search field placeholder to read "Filter"
to avoid confusion with the search feature. The icon is updated to match. This change is applied
generally in core-components so this change is made consistently across the app given the search
field is present on all pages via the sidebar.
- 2435d7a49b: Deprecated HomepageTimer in favor of HeaderWorldClock which is found in the [home plugin](https://github.com/backstage/backstage/tree/master/plugins/home)
- Updated dependencies
- @backstage/theme@0.2.11
## 0.6.1
### Patch Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-components",
"description": "Core components used by Backstage plugins and apps",
"version": "0.6.1",
"version": "0.7.0",
"private": false,
"publishConfig": {
"access": "public",
@@ -32,7 +32,7 @@
"@backstage/config": "^0.1.10",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/errors": "^0.1.2",
"@backstage/theme": "^0.2.10",
"@backstage/theme": "^0.2.11",
"@material-table/core": "^3.1.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -67,9 +67,9 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/core-app-api": "^0.1.16",
"@backstage/cli": "^0.7.15",
"@backstage/test-utils": "^0.1.18",
"@backstage/core-app-api": "^0.1.17",
"@backstage/cli": "^0.7.16",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/react-hooks": "^7.0.2",
+20
View File
@@ -1,5 +1,25 @@
# @backstage/create-app
## 0.3.45
### Patch Changes
- eaca0f53fb: The scaffolder plugin has just released the beta 3 version of software templates, which replaces the handlebars templating syntax. As part of this change, the template entity schema is no longer included in the core catalog-model as with previous versions. The decoupling of the template entities version will allow us to more easily make updates in the future.
In order to use the new beta 3 templates, the following changes are **required** for any existing installation, inside `packages/backend/src/plugins/catalog.ts`:
```diff
+import { ScaffolderEntitiesProcessor } from '@backstage/plugin-scaffolder-backend';
...
const builder = await CatalogBuilder.create(env);
+ builder.addProcessor(new ScaffolderEntitiesProcessor());
const { processingEngine, router } = await builder.build();
```
If you're interested in learning more about creating custom kinds, please check out the [extending the model](https://backstage.io/docs/features/software-catalog/extending-the-model) documentation.
## 0.3.44
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/create-app",
"description": "A CLI that helps you create your own Backstage app",
"version": "0.3.44",
"version": "0.3.45",
"private": false,
"publishConfig": {
"access": "public"
@@ -49,10 +49,5 @@
"*.{json,md}": [
"prettier --write"
]
},
"jest": {
"transformModules": [
"@asyncapi/react-component"
]
}
}
+12
View File
@@ -1,5 +1,17 @@
# @backstage/dev-utils
## 0.2.12
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/core-app-api@0.1.17
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
- @backstage/test-utils@0.1.19
- @backstage/integration-react@0.1.12
## 0.2.11
### Patch Changes
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/dev-utils",
"description": "Utilities for developing Backstage plugins.",
"version": "0.2.11",
"version": "0.2.12",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,14 +29,14 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/core-app-api": "^0.1.15",
"@backstage/core-components": "^0.6.0",
"@backstage/core-app-api": "^0.1.17",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.9",
"@backstage/catalog-model": "^0.9.3",
"@backstage/integration-react": "^0.1.11",
"@backstage/plugin-catalog-react": "^0.5.1",
"@backstage/test-utils": "^0.1.17",
"@backstage/theme": "^0.2.10",
"@backstage/integration-react": "^0.1.12",
"@backstage/plugin-catalog-react": "^0.6.0",
"@backstage/test-utils": "^0.1.19",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^5.10.1",
@@ -50,7 +50,7 @@
"react-router-dom": "6.0.0-beta.0"
},
"devDependencies": {
"@backstage/cli": "^0.7.14",
"@backstage/cli": "^0.7.16",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32"
},
+11 -24
View File
@@ -129,13 +129,22 @@ export async function waitForPageWithText(
browser: any,
path: string,
text: string,
{ intervalMs = 1000, maxLoadAttempts = 240, maxFindTextAttempts = 3 } = {},
{ intervalMs = 1000, maxLoadAttempts = 50 } = {},
) {
let loadAttempts = 0;
for (;;) {
try {
await new Promise(resolve => setTimeout(resolve, intervalMs));
const waitTimeMs = intervalMs * (Math.log10(loadAttempts + 1) + 1);
console.log(`Attempting to load page at ${path}, waiting ${waitTimeMs}`);
await new Promise(resolve => setTimeout(resolve, waitTimeMs));
await browser.visit(path);
const escapedText = text.replace(/"|\\/g, '\\$&');
browser.assert.evaluate(
`Array.from(document.querySelectorAll("*")).some(el => el.textContent === "${escapedText}")`,
true,
`expected to find text ${text}`,
);
break;
} catch (error) {
if (error.message.match(EXPECTED_LOAD_ERRORS)) {
@@ -150,28 +159,6 @@ export async function waitForPageWithText(
}
}
}
// The page may not be fully loaded and hence we need to retry.
let findTextAttempts = 0;
const escapedText = text.replace(/"|\\/g, '\\$&');
for (;;) {
try {
browser.assert.evaluate(
`Array.from(document.querySelectorAll("*")).some(el => el.textContent === "${escapedText}")`,
true,
`expected to find text ${text}`,
);
break;
} catch (error) {
findTextAttempts++;
if (findTextAttempts <= maxFindTextAttempts) {
await new Promise(resolve => setTimeout(resolve, intervalMs));
continue;
} else {
throw error;
}
}
}
}
export function print(msg: string) {
+9
View File
@@ -1,5 +1,14 @@
# @backstage/integration-react
## 0.1.12
### Patch Changes
- Updated dependencies
- @backstage/integration@0.6.8
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
## 0.1.11
### Patch Changes
+7 -7
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/integration-react",
"description": "Frontend package for managing integrations towards external systems",
"version": "0.1.11",
"version": "0.1.12",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -22,10 +22,10 @@
},
"dependencies": {
"@backstage/config": "^0.1.10",
"@backstage/core-components": "^0.6.0",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.9",
"@backstage/integration": "^0.6.6",
"@backstage/theme": "^0.2.9",
"@backstage/integration": "^0.6.8",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -34,9 +34,9 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/cli": "^0.7.14",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.17",
"@backstage/cli": "^0.7.16",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
+6
View File
@@ -1,5 +1,11 @@
# @backstage/integration
## 0.6.8
### Patch Changes
- eab072161e: By replacing `\n` with a newline for GitHub Apps private keys, this allows users to store the private key as an environment variable and reference it in the YAML.
## 0.6.7
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/integration",
"description": "Helpers for managing integrations towards external systems",
"version": "0.6.7",
"version": "0.6.8",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -39,9 +39,9 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/cli": "^0.7.16",
"@backstage/config-loader": "^0.6.10",
"@backstage/test-utils": "^0.1.18",
"@backstage/test-utils": "^0.1.19",
"@types/jest": "^26.0.7",
"@types/luxon": "^2.0.4",
"msw": "^0.29.0"
@@ -74,7 +74,7 @@ class GithubAppManager {
this.baseUrl = baseUrl;
this.baseAuthConfig = {
appId: config.appId,
privateKey: config.privateKey,
privateKey: config.privateKey.replace(/\\n/gm, '\n'),
};
this.appClient = new Octokit({
baseUrl,
+9
View File
@@ -1,5 +1,14 @@
# @backstage/test-utils
## 0.1.19
### Patch Changes
- 54bbe25c34: Store the namespaced bucket storage for each instance that was created with `MockStorage.create()` instead of global variable.
- Updated dependencies
- @backstage/core-app-api@0.1.17
- @backstage/theme@0.2.11
## 0.1.18
### Patch Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/test-utils",
"description": "Utilities to test Backstage plugins and apps.",
"version": "0.1.18",
"version": "0.1.19",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,10 +29,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/core-app-api": "^0.1.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/test-utils-core": "^0.1.3",
"@backstage/theme": "^0.2.9",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
@@ -46,7 +46,7 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/cli": "^0.7.16",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32"
},
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MockStorageApi } from './MockStorageApi';
import { StorageApi } from '@backstage/core-plugin-api';
import { MockStorageApi } from './MockStorageApi';
describe('WebStorage Storage API', () => {
const createMockStorage = (): StorageApi => {
@@ -124,7 +124,7 @@ describe('WebStorage Storage API', () => {
expect(secondStorage.get(keyName)).toBe('deerp');
});
it('should not clash with other namesapces when creating buckets', async () => {
it('should not clash with other namespaces when creating buckets', async () => {
const rootStorage = createMockStorage();
// when getting key test2 it will translate to /profile/something/deep/test2
@@ -139,4 +139,17 @@ describe('WebStorage Storage API', () => {
expect(secondStorage.get('deep/test2')).toBe(undefined);
});
it('should not reuse storage instances between different rootStorages', async () => {
const rootStorage1 = createMockStorage();
const rootStorage2 = createMockStorage();
const firstStorage = rootStorage1.forBucket('something');
const secondStorage = rootStorage2.forBucket('something');
await firstStorage.set('test2', true);
expect(firstStorage.get('test2')).toBe(true);
expect(secondStorage.get('test2')).toBe(undefined);
});
});
@@ -23,29 +23,37 @@ import ObservableImpl from 'zen-observable';
export type MockStorageBucket = { [key: string]: any };
const bucketStorageApis = new Map<string, MockStorageApi>();
export class MockStorageApi implements StorageApi {
private readonly namespace: string;
private readonly data: MockStorageBucket;
private readonly bucketStorageApis: Map<string, MockStorageApi>;
private constructor(namespace: string, data?: MockStorageBucket) {
private constructor(
namespace: string,
bucketStorageApis: Map<string, MockStorageApi>,
data?: MockStorageBucket,
) {
this.namespace = namespace;
this.bucketStorageApis = bucketStorageApis;
this.data = { ...data };
}
static create(data?: MockStorageBucket) {
return new MockStorageApi('', data);
return new MockStorageApi('', new Map(), data);
}
forBucket(name: string): StorageApi {
if (!bucketStorageApis.has(name)) {
bucketStorageApis.set(
if (!this.bucketStorageApis.has(name)) {
this.bucketStorageApis.set(
name,
new MockStorageApi(`${this.namespace}/${name}`, this.data),
new MockStorageApi(
`${this.namespace}/${name}`,
this.bucketStorageApis,
this.data,
),
);
}
return bucketStorageApis.get(name)!;
return this.bucketStorageApis.get(name)!;
}
get<T>(key: string): T | undefined {
+6
View File
@@ -1,5 +1,11 @@
# @backstage/theme
## 0.2.11
### Patch Changes
- 75bc878221: Internal refactor to avoid importing all of `@material-ui/core`.
## 0.2.10
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/theme",
"description": "material-ui theme for use with Backstage.",
"version": "0.2.10",
"version": "0.2.11",
"private": false,
"publishConfig": {
"access": "public",
@@ -31,7 +31,7 @@
"@material-ui/core": "^4.12.2"
},
"devDependencies": {
"@backstage/cli": "^0.7.9"
"@backstage/cli": "^0.7.16"
},
"files": [
"dist"
+9
View File
@@ -1,5 +1,14 @@
# @backstage/plugin-allure
## 0.1.6
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
## 0.1.5
### Patch Changes
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-allure",
"description": "A Backstage plugin that integrates with Allure",
"version": "0.1.5",
"version": "0.1.6",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -23,10 +23,10 @@
},
"dependencies": {
"@backstage/catalog-model": "^0.9.4",
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/plugin-catalog-react": "^0.5.2",
"@backstage/theme": "^0.2.10",
"@backstage/plugin-catalog-react": "^0.6.0",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -36,10 +36,10 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/core-app-api": "^0.1.16",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.7.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
+9
View File
@@ -0,0 +1,9 @@
# @backstage/plugin-analytics-module-ga
## 0.1.2
### Patch Changes
- Updated dependencies
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-analytics-module-ga",
"version": "0.1.1",
"version": "0.1.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -22,9 +22,9 @@
},
"dependencies": {
"@backstage/config": "^0.1.5",
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/theme": "^0.2.10",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -34,10 +34,10 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/core-app-api": "^0.1.16",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.7.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
+14
View File
@@ -1,5 +1,19 @@
# @backstage/plugin-api-docs
## 0.6.12
### Patch Changes
- d03ee85ff8: Bump `swagger-ui-react` to `^4.0.0-rc.3`.
- 3c50c86604: Remove unused dependency on material-icons/font
- 6ed423c139: lock down the `swagger-client`
- b6ab93c421: Add actions props to the ApiExplorerPage
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/plugin-catalog@0.7.1
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
## 0.6.11
### Patch Changes
+11 -10
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-api-docs",
"description": "A Backstage plugin that helps represent API entities in the frontend",
"version": "0.6.11",
"version": "0.6.12",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -32,11 +32,11 @@
"dependencies": {
"@asyncapi/react-component": "^0.23.0",
"@backstage/catalog-model": "^0.9.4",
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/plugin-catalog": "^0.7.0",
"@backstage/plugin-catalog-react": "^0.5.2",
"@backstage/theme": "^0.2.10",
"@backstage/plugin-catalog": "^0.7.1",
"@backstage/plugin-catalog-react": "^0.6.0",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -49,13 +49,14 @@
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^17.2.4",
"swagger-ui-react": "^4.0.0-rc.3"
"swagger-ui-react": "^4.0.0-rc.3",
"swagger-client": "3.16.1"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/core-app-api": "^0.1.16",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.7.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
@@ -15,30 +15,31 @@
*/
import { Entity, RELATION_MEMBER_OF } from '@backstage/catalog-model';
import {
CatalogApi,
catalogApiRef,
entityRouteRef,
} from '@backstage/plugin-catalog-react';
import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils';
import { render } from '@testing-library/react';
import React from 'react';
import { apiDocsConfigRef } from '../../config';
import { ApiExplorerPage } from './ApiExplorerPage';
import {
ApiProvider,
ApiRegistry,
ConfigReader,
} from '@backstage/core-app-api';
import { TableColumn, TableProps } from '@backstage/core-components';
import {
storageApiRef,
ConfigApi,
configApiRef,
storageApiRef,
} from '@backstage/core-plugin-api';
import { TableColumn, TableProps } from '@backstage/core-components';
import DashboardIcon from '@material-ui/icons/Dashboard';
import { CatalogTableRow } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
DefaultStarredEntitiesApi,
entityRouteRef,
starredEntitiesApiRef,
} from '@backstage/plugin-catalog-react';
import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils';
import DashboardIcon from '@material-ui/icons/Dashboard';
import { render } from '@testing-library/react';
import React from 'react';
import { apiDocsConfigRef } from '../../config';
import { ApiExplorerPage } from './ApiExplorerPage';
describe('ApiCatalogPage', () => {
const catalogApi: Partial<CatalogApi> = {
@@ -82,6 +83,8 @@ describe('ApiCatalogPage', () => {
getApiDefinitionWidget: () => undefined,
};
const storageApi = MockStorageApi.create();
const renderWrapped = (children: React.ReactNode) =>
render(
wrapInTestApp(
@@ -89,7 +92,11 @@ describe('ApiCatalogPage', () => {
apis={ApiRegistry.from([
[catalogApiRef, catalogApi],
[configApiRef, configApi],
[storageApiRef, MockStorageApi.create()],
[storageApiRef, storageApi],
[
starredEntitiesApiRef,
new DefaultStarredEntitiesApi({ storageApi }),
],
[apiDocsConfigRef, apiDocsConfig],
])}
>
+13
View File
@@ -1,5 +1,18 @@
# @backstage/plugin-auth-backend
## 0.4.4
### Patch Changes
- 0cfeea8f8f: AWS-ALB: update provider to the latest changes described [here](https://backstage.io/docs/auth/identity-resolver).
This removes the `ExperimentalIdentityResolver` type in favor of `SignInResolver` and `AuthHandler`.
The AWS ALB provider can now be configured in the same way as the Google provider in the example.
- defae8f579: Added extra configuration parameters for active directory file system identity
- Updated dependencies
- @backstage/test-utils@0.1.19
## 0.4.3
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-auth-backend",
"description": "A Backstage backend plugin that handles authentication",
"version": "0.4.3",
"version": "0.4.4",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -35,7 +35,7 @@
"@backstage/catalog-model": "^0.9.4",
"@backstage/config": "^0.1.10",
"@backstage/errors": "^0.1.1",
"@backstage/test-utils": "^0.1.18",
"@backstage/test-utils": "^0.1.19",
"@types/express": "^4.17.6",
"@types/passport": "^1.0.3",
"compression": "^1.7.4",
@@ -72,7 +72,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/cli": "^0.7.16",
"@types/body-parser": "^1.19.0",
"@types/cookie-parser": "^1.4.2",
"@types/express-session": "^1.17.2",
@@ -278,5 +278,59 @@ describe('GithubAuthProvider', () => {
refreshToken: 'refresh-me',
});
});
it('should forward a new refresh token on refresh', async () => {
const mockRefreshToken = jest.spyOn(
helpers,
'executeRefreshTokenStrategy',
) as unknown as jest.MockedFunction<() => Promise<{}>>;
mockRefreshToken.mockResolvedValueOnce({
accessToken: 'a.b.c',
refreshToken: 'dont-forget-to-send-refresh',
params: {
id_token: 'my-id',
expires_in: '123',
scope: 'read_user',
},
});
const mockUserProfile = jest.spyOn(
helpers,
'executeFetchUserProfileStrategy',
) as unknown as jest.MockedFunction<() => Promise<PassportProfile>>;
mockUserProfile.mockResolvedValueOnce({
id: 'mockid',
username: 'mockuser',
provider: 'github',
displayName: 'Mocked User',
emails: [
{
value: 'mockuser@gmail.com',
},
],
});
const response = await provider.refresh({} as any);
expect(response).toEqual({
backstageIdentity: {
id: 'mockuser',
token: 'token-for-mockuser',
},
profile: {
displayName: 'Mocked User',
email: 'mockuser@gmail.com',
picture: undefined,
},
providerInfo: {
accessToken: 'a.b.c',
refreshToken: 'dont-forget-to-send-refresh',
expiresInSeconds: 123,
scope: 'read_user',
},
});
});
});
});
@@ -126,7 +126,11 @@ export class GithubAuthProvider implements OAuthHandlers {
}
async refresh(req: OAuthRefreshRequest): Promise<OAuthResponse> {
const { accessToken, params } = await executeRefreshTokenStrategy(
const {
accessToken,
refreshToken: newRefreshToken,
params,
} = await executeRefreshTokenStrategy(
this._strategy,
req.refreshToken,
req.scope,
@@ -139,7 +143,7 @@ export class GithubAuthProvider implements OAuthHandlers {
fullProfile,
params,
accessToken,
refreshToken: req.refreshToken,
refreshToken: newRefreshToken,
});
}
@@ -150,6 +154,7 @@ export class GithubAuthProvider implements OAuthHandlers {
const response: OAuthResponse = {
providerInfo: {
accessToken: result.accessToken,
refreshToken: result.refreshToken, // GitHub expires the old refresh token when used
scope: result.params.scope,
expiresInSeconds:
expiresInStr === undefined ? undefined : Number(expiresInStr),
@@ -1,5 +1,12 @@
# @backstage/plugin-azure-devops-backend
## 0.1.2
### Patch Changes
- a23206049f: Updates function for mapping RepoBuilds to handle undefined properties
- b7c0585471: Expands the Azure DevOps backend plugin to provide pull request data to be used by the front end plugin
## 0.1.1
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-azure-devops-backend",
"version": "0.1.1",
"version": "0.1.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,7 +30,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.7.14",
"@backstage/cli": "^0.7.16",
"@types/supertest": "^2.0.8",
"supertest": "^4.0.2",
"msw": "^0.29.0"
+10
View File
@@ -0,0 +1,10 @@
# @backstage/plugin-azure-devops
## 0.1.1
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-azure-devops",
"version": "0.1.0",
"version": "0.1.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -28,11 +28,11 @@
},
"dependencies": {
"@backstage/catalog-model": "^0.9.3",
"@backstage/core-components": "^0.6.1",
"@backstage/core-components": "^0.7.0",
"@backstage/core-plugin-api": "^0.1.10",
"@backstage/errors": "^0.1.2",
"@backstage/plugin-catalog-react": "^0.5.1",
"@backstage/theme": "^0.2.10",
"@backstage/plugin-catalog-react": "^0.6.0",
"@backstage/theme": "^0.2.11",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
@@ -44,10 +44,10 @@
"react-use": "^17.2.4"
},
"devDependencies": {
"@backstage/cli": "^0.7.15",
"@backstage/core-app-api": "^0.1.16",
"@backstage/dev-utils": "^0.2.11",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.7.16",
"@backstage/core-app-api": "^0.1.17",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
+9
View File
@@ -1,5 +1,14 @@
# @backstage/plugin-badges
## 0.2.13
### Patch Changes
- Updated dependencies
- @backstage/plugin-catalog-react@0.6.0
- @backstage/core-components@0.7.0
- @backstage/theme@0.2.11
## 0.2.12
### Patch Changes

Some files were not shown because too many files have changed in this diff Show More