Merge branch 'master' into add-support-for-plugin-specific-db

This commit is contained in:
Patrik Oldsberg
2021-06-15 17:49:50 +02:00
committed by GitHub
253 changed files with 2621 additions and 2492 deletions
-43
View File
@@ -1,43 +0,0 @@
---
'@backstage/cli': minor
---
Switch from `ts-jest` to `@sucrase/jest-plugin`, improving performance and aligning transpilation with bundling.
In order to switch back to `ts-jest`, install `ts-jest@^26.4.3` as a dependency in the root of your repo and add the following in the root `package.json`:
```json
"jest": {
"globals": {
"ts-jest": {
"isolatedModules": true
}
},
"transform": {
"\\.esm\\.js$": "@backstage/cli/config/jestEsmTransform.js",
"\\.(js|jsx|ts|tsx)$": "ts-jest",
"\\.(bmp|gif|jpg|jpeg|png|frag|xml|svg)$": "@backstage/cli/config/jestFileTransform.js",
"\\.(yaml)$": "yaml-jest"
}
}
```
Note that this will override the default jest transforms included with the `@backstage/cli`.
It is possible that some test code needs a small migration as a result of this change, which stems from a difference in how `sucrase` and `ts-jest` transform module re-exports.
Consider the following code:
```ts
import * as utils from './utils';
jest.spyOn(utils, 'myUtility').mockReturnValue(3);
```
If the `./utils` import for example refers to an index file that in turn re-exports from `./utils/myUtility`, you would have to change the code to the following to work around the fact that the exported object from `./utils` ends up not having configurable properties, thus breaking `jest.spyOn`.
```ts
import * as utils from './utils/myUtility';
jest.spyOn(utils, 'myUtility').mockReturnValue(3);
```
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog': patch
---
A `<CatalogResultListItem />` component is now available for use in custom Search Experiences.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Exports `CatalogLayout` and `CreateComponentButton` for catalog customization.
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/create-app': patch
---
Adding .DS_Store pattern to .gitignore in Scaffolded Backstage App. To migrate an existing app that pattern should be added manually.
```diff
+# macOS
+.DS_Store
```
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-api': patch
---
Improve forwards compatibility with `@backstage/core-app-api` and `@backstage/core-plugin-api` by re-using route reference types and factory methods from `@backstage/core-plugin-api`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-cost-insights': patch
---
Move `canvas` package to `devDependencies`.
+52
View File
@@ -0,0 +1,52 @@
---
'@backstage/plugin-catalog-backend': patch
'@backstage/create-app': patch
---
This release enables the new catalog processing engine which is a major milestone for the catalog!
This update makes processing more scalable across multiple instances, adds support for deletions and ui flagging of entities that are no longer referenced by a location.
**Changes Required** to `catalog.ts`
```diff
-import { useHotCleanup } from '@backstage/backend-common';
import {
CatalogBuilder,
- createRouter,
- runPeriodically
+ createRouter
} from '@backstage/plugin-catalog-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
export default async function createPlugin(env: PluginEnvironment): Promise<Router> {
- const builder = new CatalogBuilder(env);
+ const builder = await CatalogBuilder.create(env);
const {
entitiesCatalog,
locationsCatalog,
- higherOrderOperation,
+ locationService,
+ processingEngine,
locationAnalyzer,
} = await builder.build();
- useHotCleanup(
- module,
- runPeriodically(() => higherOrderOperation.refreshAllLocations(), 100000),
- );
+ await processingEngine.start();
return await createRouter({
entitiesCatalog,
locationsCatalog,
- higherOrderOperation,
+ locationService,
locationAnalyzer,
logger: env.logger,
config: env.config,
```
As this is a major internal change we have taken some precaution by still allowing the old catalog to be enabled by keeping your `catalog.ts` in it's current state.
If you encounter any issues and have to revert to the previous catalog engine make sure to raise an issue immediately as the old catalog engine is deprecated and will be removed in a future release.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-app-api': patch
---
Fixes a type bug where supplying all app icons to `createApp` was required, rather than just a partial list.
-43
View File
@@ -1,43 +0,0 @@
---
'@backstage/create-app': patch
---
Updated the `@gitbeaker/node` dependency past the broken one without a `dist` folder.
See [this issue](https://github.com/jdalrymple/gitbeaker/issues/1861) for more details.
If you get build errors that look like the following in your Backstage instance, you may want to also bump all of your `@gitbeaker/*` dependencies to at least `^30.2.0`.
```
node:internal/modules/cjs/loader:356
throw err;
^
Error: Cannot find module '/path/to/project/node_modules/@gitbeaker/node/dist/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:348:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:561:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:926:27)
at Function.Module._load (node:internal/modules/cjs/loader:773:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/path/to/project/test.js:4:18)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'MODULE_NOT_FOUND',
path: '/path/to/project/node_modules/@gitbeaker/node/package.json',
requestPath: '@gitbeaker/node'
}
```
you could also consider pinning the version to an older one in your `package.json` either root or `packages/backend/package.json`, before the breakage occurred.
```json
"resolutions": {
"**/@gitbeaker/node": "29.2.4",
"**/@gitbeaker/core": "29.2.4",
"**/@gitbeaker/requester-utils": "29.2.4"
}
```
Be aware that this is only required short term until we can release our updated versions of `@backstage/plugin-scaffolder-backend`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog-backend': patch
---
Restructure the next catalog types and files a bit
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-common': patch
---
Provide a more clear error message when database connection fails.
+24
View File
@@ -0,0 +1,24 @@
---
'@backstage/cli': patch
---
Make `yarn dev` in newly created backend plugins respect the `PLUGIN_PORT` environment variable.
You can achieve the same in your created backend plugins by making sure to properly call the port and CORS methods on your service builder. Typically in a file named `src/service/standaloneServer.ts` inside your backend plugin package, replace the following:
```ts
const service = createServiceBuilder(module)
.enableCors({ origin: 'http://localhost:3000' })
.addRouter('/my-plugin', router);
```
With something like the following:
```ts
let service = createServiceBuilder(module)
.setPort(options.port)
.addRouter('/my-plugin', router);
if (options.enableCors) {
service = service.enableCors({ origin: 'http://localhost:3000' });
}
```
-34
View File
@@ -1,34 +0,0 @@
---
'@backstage/core-app-api': patch
'@backstage/core-components': patch
'@backstage/core-plugin-api': patch
---
This change adds automatic error boundaries around extensions.
This means that all exposed parts of a plugin are wrapped in a general error boundary component, that is plugin aware. The default design for the error box is borrowed from `@backstage/errors`. To override the default "fallback", one must provide a component named `ErrorBoundaryFallback` to `createApp`, like so:
```ts
const app = createApp({
components: {
ErrorBoundaryFallback: props => {
// a custom fallback component
return (
<>
<h1>Oops.</h1>
<h2>
The plugin {props.plugin.getId()} failed with {props.error.message}
</h2>
<button onClick={props.resetError}>Try again</button>
</>
);
},
},
});
```
The props here include:
- `error`. An `Error` object or something that inherits it that represents the error that was thrown from any inner component.
- `resetError`. A callback that will simply attempt to mount the children of the error boundary again.
- `plugin`. A `BackstagePlugin` that can be used to look up info to be presented in the error message. For instance, you may want to keep a map of your internal plugins and team names or slack channels and present these when an error occurs. Typically, you'll do that by getting the plugin ID with `plugin.getId()`.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-splunk-on-call': patch
---
Added config schema to expose `splunkOnCall.eventsRestEndpoint` config option to the frontend
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/codemods': patch
---
Fix execution of `jscodeshift` on windows.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Switches the default catalog processing engine to use a batched streaming task execution strategy for higher parallelism.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/backend-test-utils': patch
---
Skip running docker tests unless in CI
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Rely on `SELECT ... FOR UPDATE SKIP LOCKED` where available in order to speed up processing item acquisition and reduce work duplication.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Use the correct parameter to create a public repository in Bitbucket Server for the v2 templates
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-github-actions': patch
---
Add missing token on job list call to GitHub API
-23
View File
@@ -1,23 +0,0 @@
---
'@backstage/backend-common': patch
---
Omits the `upgrade-insecure-requests` Content-Security-Policy directive by default, to prevent automatic HTTPS request upgrading for HTTP-deployed Backstage sites.
If you previously disabled this using `false` in your `app-config.yaml`, this line is no longer necessary:
```diff
backend:
csp:
- upgrade-insecure-requests: false
```
To keep the existing behavior of `upgrade-insecure-requests` Content-Security-Policy being _enabled_, add the key with an empty array as the value in your `app-config.yaml`:
```diff
backend:
+ csp:
+ upgrade-insecure-requests: []
```
Read more on [upgrade-insecure-requests here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests).
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Fix the link to the documentation page when no owned documents are displayed
-23
View File
@@ -1,23 +0,0 @@
---
'@backstage/catalog-model': patch
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-scaffolder-backend': patch
---
Introduce conditional steps in scaffolder templates.
A step can now include an `if` property that only executes a step if the
condition is truthy. The condition can include handlebar templates.
```yaml
- id: register
if: '{{ not parameters.dryRun }}'
name: Register
action: catalog:register
input:
repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}'
catalogInfoPath: '/catalog-info.yaml'
```
Also introduces a `not` helper in handlebar templates that allows to negate
boolean expressions.
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-catalog-backend': patch
---
Make refresh interval configurable for the `NextCatalogBuilder` using `.setRefreshIntervalSeconds()`.
Change `DefaultProcessingDatabase` constructor to accept an options object instead of individual arguments.
@@ -2,4 +2,4 @@
'@backstage/plugin-scaffolder-backend': patch
---
Add `debug:log` action for debugging.
Adds support to enable LFS for hosted Bitbucket
-8
View File
@@ -1,8 +0,0 @@
---
'@backstage/integration-react': patch
'@backstage/plugin-catalog': patch
---
Move `ScmIntegrationIcon` from `@backstage/plugin-catalog` to
`@backstage/integration-react` and make it customizable using
`app.getSystemIcon()`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder-backend': minor
---
Scaffolding a repository in Bitbucket will now use the apiBaseUrl if it is provided instead of only the host parameter
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Fix a react warning in `<EntityListComponent>`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder': patch
---
Provide a link to the template source on the `TemplateCard`.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Updated dependencies
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-plugin-api': patch
---
Apply fixes to the extension creation API that were mistakenly applied to `@backstage/core-app-api` instead.
-17
View File
@@ -1,17 +0,0 @@
---
'@backstage/create-app': patch
'@backstage/plugin-scaffolder-backend': patch
---
Migrating old `backstage.io/v1alpha1` templates to `backstage.io/v1beta2`
Deprecating the `create-react-app` Template. We're planning on removing the `create-react-app` templater, as it's been a little tricky to support and takes 15mins to run in a container. We've currently cached a copy of the output for `create-react-app` and ship that under our sample templates folder. If you want to continue using it, we suggest copying the template out of there and putting it in your own repository as it will be removed in upcoming releases.
We also recommend removing this entry from your `app-config.yaml` if it exists:
```diff
- - type: url
- target: https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/sample-templates/create-react-app/template.yaml
- rules:
- - allow: [Template]
```
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-app-api': patch
---
Deprecate and disable the extension creation methods, which were added to this package by mistake and should only exist within `@backstage/core-plugin-api`.
+12
View File
@@ -0,0 +1,12 @@
---
'@backstage/plugin-app-backend': patch
'@backstage/plugin-badges-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-code-coverage-backend': patch
'@backstage/plugin-proxy-backend': patch
'@backstage/plugin-rollbar-backend': patch
'@backstage/plugin-search-backend': patch
'@backstage/plugin-techdocs-backend': patch
---
Make `yarn dev` respect the `PLUGIN_PORT` environment variable.
-7
View File
@@ -1,7 +0,0 @@
---
'@backstage/plugin-catalog': patch
'@backstage/plugin-catalog-react': patch
---
Expose `getEntitySourceLocation`, `getEntityMetadataViewUrl`, and
`getEntityMetadataEditUrl` from `@backstage/plugin-catalog-react`.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-user-settings': patch
---
Fix a bug that prevented changing themes on the user settings page when the theme `id` didn't match exactly the theme `variant`.
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/catalog-client': patch
'@backstage/plugin-catalog-import': patch
---
Display preview result final step.
-9
View File
@@ -1,9 +0,0 @@
---
'@backstage/search-common': patch
'@backstage/plugin-search-backend-node': patch
'@backstage/plugin-search': patch
---
The `<Search...Next /> set of components exported by the Search Plugin are now updated to use the Search Backend API. These will be made available as the default non-"next" versions in a follow-up release.
The interfaces for decorators and collators in the Search Backend have also seen minor, breaking revisions ahead of a general release. If you happen to be building on top of these interfaces, check and update your implementations accordingly. The APIs will be considered more stable in a follow-up release.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/config-loader': patch
---
Removed workaround for breaking change in typescript 4.3 and bump `typescript-json-schema` instead. This should again allow the usage of `@items.visibility <value>` to set the visibility of array items.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-github-deployments': patch
---
Add deployment statuses to the GithubDeployments plugin
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-app-api': patch
---
Update `createApp` options to allow plugins with unknown output types in order to improve forwards and backwards compatibility.
-9
View File
@@ -1,9 +0,0 @@
---
'@backstage/cli': patch
---
Fix error message formatting in the packaging process.
error.errors can be undefined which will lead to a TypeError, swallowing the actual error message in the process.
For instance, if you break your tsconfig.json with invalid syntax, backstage-cli will not be able to build anything and it will be very hard to find out why because the underlying error message is hidden behind a TypeError.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog': patch
---
A new card that shows components that depend on the active component
@@ -2,4 +2,4 @@
'@backstage/core-components': patch
---
Use app.title for helmet in header
Add title prop in SupportButton component
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/backend-common': patch
'@backstage/integration': patch
---
Download archives as compressed tar files for Bitbucket to keep executable permissions.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Adding support for user owned document filter for TechDocs custom Homepage
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Migrate from the `command-exists-promise` dependency to `command-exists`.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/catalog-model': patch
---
Removed unused `typescript-json-schema` dependency.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Use the correct parameter to create a public repository in Bitbucket Server.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Update gitbeaker past the broken version without a dist folder
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-proxy-backend': patch
---
Bump http-proxy-middleware from 0.19.2 to 2.0.0
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog': patch
---
Exported AboutCard contents and utility functions
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-proxy-backend': patch
---
Fixed proxy requests to the base URL of routes without a trailing slash redirecting to the `target` with the full path appended.
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core': patch
'@backstage/core-components': patch
---
Use the Backstage `Link` component in the `Button`
+1 -1
View File
@@ -4,7 +4,7 @@
# The last matching pattern takes precedence.
# https://help.github.com/articles/about-codeowners/
* @backstage/maintainers
* @backstage/reviewers
/docs/features/techdocs @backstage/techdocs-core
/docs/features/search @backstage/techdocs-core
/docs/assets/search @backstage/techdocs-core
+4
View File
@@ -53,6 +53,10 @@ jobs:
- name: verify type dependencies
run: yarn lint:type-deps
# The core packages need to be built for the codemods tests to work
- name: build core packages
run: lerna run --scope @backstage/core-* build
- name: test
run: yarn lerna -- run test
env:
+25 -1
View File
@@ -36,9 +36,33 @@ To become a maintainer you need to demonstrate the following:
If a maintainer is no longer interested or cannot perform the maintainer duties listed above, they should volunteer to be moved to emeritus status. In extreme cases this can also occur by a vote of the sponsors and maintainers per the voting process below.
# Reviewers
The project also contains a team called [@backstage/reviewers](https://github.com/orgs/backstage/teams/reviewers). This is the team of people who are the fallback in [`CODEOWNERS`](./.github/CODEOWNERS). This team will typically contain the maintainers, and a small number of additional people who are permitted to approve and merge pull requests. The purpose of this group is to offload some of the review work from the maintainers, simplifying and speeding up the review process for contributors.
This responsibility is distinct from the maintainer role. A reviewer must not approve and merge changes that have a level of impact that a maintainer should oversee; see below for clarification. For that class of changes, a reviewer can still review the pull request thoroughly without approving it (e.g. with a comment on the pull request), and is expected to notify `@backstage/maintainers` for final approval. Note that it is best to not use the GitHub review approve functionality for this, since that would let Hall of Fame members self-merge the pull request before maintainers get the chance to look at it.
The following is a non-exhaustive list of types of change, for which a reviewer should defer final decision and merge to a maintainer:
- A larger refactoring that significantly affects the structure of/between packages
- Changes that settle or alter the trajectory of contested ongoing topics in issues or elsewhere
- Changes that affect the [Architecture Decision Records](./docs/architecture-decisions)
- Changes to APIs that have large customer impact, such as the core APIs in `@backstage/core-*` packages, or significant `@backstage/cli` changes.
- Pull requests whose build checks are not passing fully
- Additions and removals of entire packages
- Releases (e.g. pull requests titled `Version Packages`)
A maintainer may suggest an addition to the reviewers team by opening a pull request that modifies [`OWNERS.md`](./OWNERS.md) accordingly. Prospective reviewers are not expected to do this themselves, but should rather ask a maintainer to sponsor their addition. All of the maintainers and sponsors are called to vote on the addition (see the section below about voting). If the vote passes, the pull request can be approved and merged, and the corresponding addition to the GitHub team can be made.
A reviewer can elect to remove themselves from the reviewers group by opening, or asking a maintainer to open, a pull request that modifies [`OWNERS.md`](./OWNERS.md) accordingly. A maintainer will approve and merge the pull request, and the corresponding removal from the GitHub team can be made.
A maintainer can call on the other maintainers and sponsors for a vote to remove a reviewer (see the section below about conflict resolution and voting). If the vote passes, a maintainer creates a pull request that modifies [`OWNERS.md`](./OWNERS.md) accordingly. After approval by another maintainer, the pull request can be merged, and the corresponding removal from the GitHub team can be made.
# Conflict resolution and voting
In general, we prefer that technical issues and maintainer membership are amicably worked out between the persons involved. If a dispute cannot be decided independently, the sponsors and maintainers can be called in to decide an issue. If the sponsors and maintainers themselves cannot decide an issue, the issue will be resolved by voting. The voting process is a simple majority in which each sponsor receives two votes and each maintainer receives one vote.
In general, we prefer that technical issues and membership are amicably worked out between the persons involved. If a dispute cannot be decided independently, the sponsors and maintainers can be called in to decide an issue. If the sponsors and maintainers themselves cannot decide an issue, the issue will be resolved by voting.
In all cases in this document where voting is mentioned, the voting process is a simple majority in which each sponsor receives two votes and each maintainer receives one vote. If such a majority is reached, the vote is said to have _passed_.
# Adding new projects to the Backstage GitHub organization
+12
View File
@@ -16,6 +16,18 @@ This page lists all active sponsors and maintainers.
- Ben Lambert ([benjdlambert](https://github.com/benjdlambert)) (Discord: @blam)
- Johan Haals ([jhaals](https://github.com/jhaals)) (Discord: @jhaals)
# Reviewers
See [`GOVERNANCE.md`](./GOVERNANCE.md) for details about how the reviewers team
works.
- Patrik Oldsberg ([rugvip](https://github.com/rugvip)) (Discord: @Rugvip)
- Fredrik Adelöw ([freben](https://github.com/freben)) (Discord: @freben)
- Ben Lambert ([benjdlambert](https://github.com/benjdlambert)) (Discord: @blam)
- Johan Haals ([jhaals](https://github.com/jhaals)) (Discord: @jhaals)
- Himanshu Mishra ([OrkoHunter](https://github.com/OrkoHunter)) (Discord: @OrkoHunter)
- Tim Hansen ([timbonicus](https://github.com/timbonicus)) (Discord: @timbonicus)
# Emeritus maintainers
- Stefan Ålund ([stefanalund](https://github.com/stefanalund)) (Discord: @stalund)
+39
View File
@@ -111,3 +111,42 @@ curl localhost:7000/api/carmen/health
```
This should return `{"status":"ok"}` like before. Success!
## Making Use of a Database
The Backstage backend comes with a builtin facility for SQL database access.
Most plugins that have persistence needs will choose to make use of this
facility, so that Backstage operators can manage database needs uniformly.
As part of the environment object that is passed to your `createPlugin`
function, there is a `database` field. You can use that to get a
[Knex](http://knexjs.org/) connection object.
```ts
// in packages/backend/src/plugins/carmen.ts
export default async function createPlugin(env: PluginEnvironment) {
const db: Knex<any, unknown[]> = await env.database.getClient();
// You will then pass this client into your actual plugin implementation
// code, maybe similar to the following:
const model = new CarmenDatabaseModel(db);
return await createRouter({
model: model,
logger: env.logger,
});
}
```
You may note that the `getClient` call has no parameters. This is because all
plugin database needs are configured under the `backend.database` config key of
your `app-config.yaml`. The framework may even make sure behind the scenes that
the logical database is created automatically if it doesn't exist, based on
rules that the Backstage operator decides on.
The framework does not handle database schema migrations for you, however. The
builtin plugins in the main repo have chosen to use the Knex library to manage
schema migrations as well, but you can do so in any manner that you see fit.
See the [Knex library documentation](http://knexjs.org/) for examples and
details on how to write schema migrations and perform SQL queries against your
database..
+15
View File
@@ -0,0 +1,15 @@
---
title: GKE Usage
author: BESTSELLER
authorUrl: bestsellerit.com
category: Discovery
description: This plugin will show you the cost and resource usage of your application within GKE.
documentation: https://github.com/BESTSELLER/backstage-plugin-gkeusage/blob/master/README.md
iconUrl: https://bestsellerit.com/img/google-container-engine_avatar.svg
npmPackageName: '@bestsellerit/backstage-plugin-gkeusage'
tags:
- gke
- cost
- google
- usage
- metering
+1 -1
View File
@@ -20,7 +20,7 @@
"docusaurus": "^2.0.0-alpha.70",
"js-yaml": "^4.1.0",
"prettier": "^2.3.1",
"yarn-lock-check": "^1.0.4"
"yarn-lock-check": "^1.0.5"
},
"prettier": "@spotify/prettier-config"
}
+2 -4
View File
@@ -92,10 +92,8 @@ const siteConfig = {
cleanUrl: true,
// Open Graph and Twitter card images.
ogImage:
'logo_assets/png/Backstage_Identity_Assets_Artwork_RGB_04_Icon_Teal.png',
twitterImage:
'logo_assets/png/Backstage_Identity_Assets_Artwork_RGB_04_Icon_Teal.png',
ogImage: 'img/sharing-opengraph.png',
twitterImage: 'img/twitter-summary.png',
// For sites with a sizable amount of content, set collapsible to true.
// Expand/collapse the links and subcategories under categories.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

+9 -120
View File
@@ -9,13 +9,6 @@
dependencies:
"@babel/highlight" "^7.0.0"
"@babel/code-frame@^7.0.0":
version "7.12.13"
resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658"
integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==
dependencies:
"@babel/highlight" "^7.12.13"
"@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.11":
version "7.12.11"
resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
@@ -227,11 +220,6 @@
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
"@babel/helper-validator-identifier@^7.14.0":
version "7.14.0"
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288"
integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==
"@babel/helper-validator-option@^7.12.1", "@babel/helper-validator-option@^7.12.11":
version "7.12.11"
resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.11.tgz#d66cb8b7a3e7fe4c6962b32020a131ecf0847f4f"
@@ -265,15 +253,6 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/highlight@^7.12.13":
version "7.14.0"
resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz#3197e375711ef6bf834e67d0daec88e4f46113cf"
integrity sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==
dependencies:
"@babel/helper-validator-identifier" "^7.14.0"
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/parser@^7.12.10", "@babel/parser@^7.12.11", "@babel/parser@^7.12.7":
version "7.12.11"
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.12.11.tgz#9ce3595bcd74bc5c466905e86c535b8b25011e79"
@@ -942,29 +921,11 @@
dependencies:
"@types/node" "*"
"@types/glob@^7.1.3":
version "7.1.3"
resolved "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183"
integrity sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==
dependencies:
"@types/minimatch" "*"
"@types/node" "*"
"@types/minimatch@*":
version "3.0.4"
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
"@types/node@*":
version "14.14.20"
resolved "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz#f7974863edd21d1f8a494a73e8e2b3658615c340"
integrity sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==
"@types/node@^15.6.1":
version "15.9.0"
resolved "https://registry.npmjs.org/@types/node/-/node-15.9.0.tgz#0b7f6c33ca5618fe329a9d832b478b4964d325a8"
integrity sha512-AR1Vq1Ei1GaA5FjKL5PBqblTZsL5M+monvGSZwe6sSIdGiuu7Xr/pNwWJY+0ZQuN8AapD/XMB5IzBAyYRFbocA==
"@types/q@^1.5.1":
version "1.5.4"
resolved "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24"
@@ -1449,11 +1410,6 @@ buffer@^5.2.1:
base64-js "^1.3.1"
ieee754 "^1.1.13"
builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=
bytes@1:
version "1.0.0"
resolved "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz#3569ede8ba34315fab99c3e92cb04c7220de1fa8"
@@ -1567,7 +1523,7 @@ caw@^2.0.0, caw@^2.0.1:
tunnel-agent "^0.6.0"
url-to-options "^1.0.1"
chalk@2.4.2, chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2:
chalk@2.4.2, chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@@ -1758,7 +1714,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
commander@^2.12.1, commander@^2.8.1:
commander@^2.8.1:
version "2.20.3"
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@@ -2230,11 +2186,6 @@ diacritics-map@^0.1.0:
resolved "https://registry.npmjs.org/diacritics-map/-/diacritics-map-0.1.0.tgz#6dfc0ff9d01000a2edf2865371cac316e94977af"
integrity sha1-bfwP+dAQAKLt8oZTccrDFulJd68=
diff@^4.0.1:
version "4.0.2"
resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
dir-glob@2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034"
@@ -3091,19 +3042,7 @@ glob-to-regexp@^0.3.0:
resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
glob@^7.0.0, glob@^7.0.5, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@~7.1.1:
version "7.1.6"
resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.1, glob@^7.1.7:
glob@^7.0.0, glob@^7.0.5, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@^7.1.7, glob@~7.1.1:
version "7.1.7"
resolved "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90"
integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==
@@ -3638,13 +3577,6 @@ is-core-module@^2.1.0:
dependencies:
has "^1.0.3"
is-core-module@^2.2.0:
version "2.4.0"
resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz#8e9fc8e15027b011418026e98f0e6f4d86305cc1"
integrity sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==
dependencies:
has "^1.0.3"
is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
@@ -4457,7 +4389,7 @@ mixin-deep@^1.1.3, mixin-deep@^1.2.0:
for-in "^1.0.2"
is-extendable "^1.0.1"
mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1:
mkdirp@^0.5.1, mkdirp@^0.5.5, mkdirp@~0.5.1:
version "0.5.5"
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def"
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==
@@ -5681,14 +5613,6 @@ resolve@^1.1.6, resolve@^1.10.0:
is-core-module "^2.1.0"
path-parse "^1.0.6"
resolve@^1.3.2:
version "1.20.0"
resolved "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
dependencies:
is-core-module "^2.2.0"
path-parse "^1.0.6"
responselike@1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7"
@@ -6437,37 +6361,11 @@ truncate-html@^1.0.3:
"@types/cheerio" "^0.22.8"
cheerio "0.22.0"
tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
tslib@^1.9.0, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslint@^6.1.3:
version "6.1.3"
resolved "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904"
integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==
dependencies:
"@babel/code-frame" "^7.0.0"
builtin-modules "^1.1.1"
chalk "^2.3.0"
commander "^2.12.1"
diff "^4.0.1"
glob "^7.1.1"
js-yaml "^3.13.1"
minimatch "^3.0.4"
mkdirp "^0.5.3"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.13.0"
tsutils "^2.29.0"
tsutils@^2.29.0:
version "2.29.0"
resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99"
integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==
dependencies:
tslib "^1.8.1"
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
@@ -6493,11 +6391,6 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^4.3.2:
version "4.3.2"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
unbzip2-stream@^1.0.9:
version "1.4.3"
resolved "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7"
@@ -6767,18 +6660,14 @@ yargs@^2.3.0:
dependencies:
wordwrap "0.0.2"
yarn-lock-check@^1.0.4:
version "1.0.4"
resolved "https://registry.npmjs.org/yarn-lock-check/-/yarn-lock-check-1.0.4.tgz#a0373de051be0c8442d8933070df7a45595263b4"
integrity sha512-Gj0wRN85c4OPZUlE7WsQ0a1COv38uyeWWR0YAvJr2Vxw1f32bwK19xySjUZlxt9o4QopJkd8g6x6CLv81OHwYg==
yarn-lock-check@^1.0.5:
version "1.0.5"
resolved "https://registry.npmjs.org/yarn-lock-check/-/yarn-lock-check-1.0.5.tgz#69d9516385f3ff010d0e2b0e87fbbd9bb1ffecaf"
integrity sha512-dxmV4LpIBrRAPbPg+klyGvqdVo3Y6PgJs6ERJYXf0HSEst7klDmvKKqQUtk+wrIRCoMDIVIzSUTZsuC4zr/tFQ==
dependencies:
"@types/glob" "^7.1.3"
"@types/node" "^15.6.1"
"@yarnpkg/lockfile" "^1.1.0"
glob "^7.1.7"
ini "^2.0.0"
tslint "^6.1.3"
typescript "^4.3.2"
yauzl@^2.4.2:
version "2.10.0"
+1 -1
View File
@@ -68,7 +68,7 @@
"prettier": "^2.2.1",
"recursive-readdir": "^2.2.2",
"shx": "^0.3.2",
"yarn-lock-check": "^1.0.4"
"yarn-lock-check": "^1.0.5"
},
"prettier": "@spotify/prettier-config",
"lint-staged": {
+30
View File
@@ -1,5 +1,35 @@
# example-app
## 0.2.32
### Patch Changes
- Updated dependencies [9cd3c533c]
- Updated dependencies [db1c8f93b]
- Updated dependencies [9d906c7a1]
- Updated dependencies [9bdd2cca8]
- Updated dependencies [27a9b503a]
- Updated dependencies [f4e3ac5ce]
- Updated dependencies [9b4010965]
- Updated dependencies [7f7443308]
- Updated dependencies [7028ee1ca]
- Updated dependencies [70bc30c5b]
- Updated dependencies [db1c8f93b]
- Updated dependencies [5aff84759]
- Updated dependencies [21e8ebef5]
- Updated dependencies [4fbb00707]
- Updated dependencies [d5ad47bbb]
- @backstage/cli@0.7.0
- @backstage/plugin-catalog@0.6.2
- @backstage/plugin-cost-insights@0.10.2
- @backstage/plugin-github-actions@0.4.9
- @backstage/catalog-model@0.8.2
- @backstage/plugin-scaffolder@0.9.8
- @backstage/integration-react@0.1.3
- @backstage/plugin-catalog-react@0.2.2
- @backstage/plugin-catalog-import@0.5.9
- @backstage/plugin-search@0.4.0
## 0.2.31
### Patch Changes
+11 -11
View File
@@ -1,25 +1,25 @@
{
"name": "example-app",
"version": "0.2.31",
"version": "0.2.32",
"private": true,
"bundled": true,
"dependencies": {
"@backstage/catalog-model": "^0.8.1",
"@backstage/cli": "^0.6.14",
"@backstage/catalog-model": "^0.8.2",
"@backstage/cli": "^0.7.0",
"@backstage/core": "^0.7.12",
"@backstage/integration-react": "^0.1.2",
"@backstage/integration-react": "^0.1.3",
"@backstage/plugin-api-docs": "^0.4.15",
"@backstage/plugin-badges": "^0.2.2",
"@backstage/plugin-catalog": "^0.6.1",
"@backstage/plugin-catalog-import": "^0.5.8",
"@backstage/plugin-catalog-react": "^0.2.1",
"@backstage/plugin-catalog": "^0.6.2",
"@backstage/plugin-catalog-import": "^0.5.9",
"@backstage/plugin-catalog-react": "^0.2.2",
"@backstage/plugin-circleci": "^0.2.15",
"@backstage/plugin-cloudbuild": "^0.2.16",
"@backstage/plugin-code-coverage": "^0.1.4",
"@backstage/plugin-cost-insights": "^0.10.1",
"@backstage/plugin-cost-insights": "^0.10.2",
"@backstage/plugin-explore": "^0.3.6",
"@backstage/plugin-gcp-projects": "^0.2.6",
"@backstage/plugin-github-actions": "^0.4.8",
"@backstage/plugin-github-actions": "^0.4.9",
"@backstage/plugin-graphiql": "^0.2.11",
"@backstage/plugin-jenkins": "^0.4.4",
"@backstage/plugin-kafka": "^0.2.8",
@@ -29,8 +29,8 @@
"@backstage/plugin-org": "^0.3.14",
"@backstage/plugin-pagerduty": "0.3.5",
"@backstage/plugin-rollbar": "^0.3.6",
"@backstage/plugin-scaffolder": "^0.9.7",
"@backstage/plugin-search": "^0.3.7",
"@backstage/plugin-scaffolder": "^0.9.8",
"@backstage/plugin-search": "^0.4.0",
"@backstage/plugin-sentry": "^0.3.11",
"@backstage/plugin-shortcuts": "^0.1.2",
"@backstage/plugin-tech-radar": "^0.4.0",
+28
View File
@@ -1,5 +1,33 @@
# @backstage/backend-common
## 0.8.2
### Patch Changes
- 92963779b: Omits the `upgrade-insecure-requests` Content-Security-Policy directive by default, to prevent automatic HTTPS request upgrading for HTTP-deployed Backstage sites.
If you previously disabled this using `false` in your `app-config.yaml`, this line is no longer necessary:
```diff
backend:
csp:
- upgrade-insecure-requests: false
```
To keep the existing behavior of `upgrade-insecure-requests` Content-Security-Policy being _enabled_, add the key with an empty array as the value in your `app-config.yaml`:
```diff
backend:
+ csp:
+ upgrade-insecure-requests: []
```
Read more on [upgrade-insecure-requests here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests).
- eda9dbd5f: Download archives as compressed tar files for Bitbucket to keep executable permissions.
- Updated dependencies [eda9dbd5f]
- @backstage/integration@0.5.6
## 0.8.1
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-common",
"description": "Common functionality library for Backstage backends",
"version": "0.8.1",
"version": "0.8.2",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -33,7 +33,7 @@
"@backstage/config": "^0.1.5",
"@backstage/config-loader": "^0.6.2",
"@backstage/errors": "^0.1.1",
"@backstage/integration": "^0.5.3",
"@backstage/integration": "^0.5.6",
"@google-cloud/storage": "^5.8.0",
"@octokit/rest": "^18.5.3",
"@types/cors": "^2.8.6",
@@ -76,7 +76,7 @@
}
},
"devDependencies": {
"@backstage/cli": "^0.6.12",
"@backstage/cli": "^0.7.0",
"@backstage/test-utils": "^0.1.12",
"@types/archiver": "^5.1.0",
"@types/compression": "^1.7.0",
+14
View File
@@ -0,0 +1,14 @@
# @backstage/backend-test-utils
## 0.1.2
### Patch Changes
- 0711954a9: Skip running docker tests unless in CI
- Updated dependencies [9cd3c533c]
- Updated dependencies [92963779b]
- Updated dependencies [7f7443308]
- Updated dependencies [21e8ebef5]
- Updated dependencies [eda9dbd5f]
- @backstage/cli@0.7.0
- @backstage/backend-common@0.8.2
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-test-utils",
"description": "Test helpers library for Backstage backends",
"version": "0.1.1",
"version": "0.1.2",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -30,8 +30,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.8.0",
"@backstage/cli": "^0.6.10",
"@backstage/backend-common": "^0.8.2",
"@backstage/cli": "^0.7.0",
"@backstage/config": "^0.1.5",
"knex": "^0.95.1",
"mysql2": "^2.2.5",
@@ -41,7 +41,7 @@
"uuid": "^8.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.6.10",
"@backstage/cli": "^0.7.0",
"jest": "^26.0.1"
},
"files": [
+26
View File
@@ -1,5 +1,31 @@
# example-backend
## 0.2.32
### Patch Changes
- Updated dependencies [9c63be545]
- Updated dependencies [92963779b]
- Updated dependencies [27a9b503a]
- Updated dependencies [66c6bfebd]
- Updated dependencies [55a253de2]
- Updated dependencies [70bc30c5b]
- Updated dependencies [db1c8f93b]
- Updated dependencies [5aff84759]
- Updated dependencies [f26e6008f]
- Updated dependencies [eda9dbd5f]
- Updated dependencies [4f8cf50fe]
- Updated dependencies [875809a59]
- @backstage/plugin-catalog-backend@0.10.2
- @backstage/backend-common@0.8.2
- @backstage/catalog-model@0.8.2
- @backstage/plugin-scaffolder-backend@0.12.0
- @backstage/catalog-client@0.3.13
- @backstage/plugin-search-backend-node@0.2.0
- @backstage/plugin-search-backend@0.2.0
- @backstage/plugin-proxy-backend@0.2.9
- example-app@0.2.32
## 0.2.30
### Patch Changes
+11 -11
View File
@@ -1,6 +1,6 @@
{
"name": "example-backend",
"version": "0.2.30",
"version": "0.2.32",
"main": "dist/index.cjs.js",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -27,30 +27,30 @@
"migrate:create": "knex migrate:make -x ts"
},
"dependencies": {
"@backstage/backend-common": "^0.8.0",
"@backstage/catalog-client": "^0.3.12",
"@backstage/catalog-model": "^0.8.0",
"@backstage/backend-common": "^0.8.2",
"@backstage/catalog-client": "^0.3.13",
"@backstage/catalog-model": "^0.8.2",
"@backstage/config": "^0.1.5",
"@backstage/plugin-app-backend": "^0.3.13",
"@backstage/plugin-auth-backend": "^0.3.12",
"@backstage/plugin-badges-backend": "^0.1.6",
"@backstage/plugin-catalog-backend": "^0.10.0",
"@backstage/plugin-catalog-backend": "^0.10.2",
"@backstage/plugin-code-coverage-backend": "^0.1.6",
"@backstage/plugin-graphql-backend": "^0.1.8",
"@backstage/plugin-kubernetes-backend": "^0.3.8",
"@backstage/plugin-kafka-backend": "^0.2.6",
"@backstage/plugin-proxy-backend": "^0.2.8",
"@backstage/plugin-proxy-backend": "^0.2.9",
"@backstage/plugin-rollbar-backend": "^0.1.11",
"@backstage/plugin-scaffolder-backend": "^0.11.4",
"@backstage/plugin-search-backend": "^0.1.5",
"@backstage/plugin-search-backend-node": "^0.1.3",
"@backstage/plugin-scaffolder-backend": "^0.12.0",
"@backstage/plugin-search-backend": "^0.2.0",
"@backstage/plugin-search-backend-node": "^0.2.0",
"@backstage/plugin-techdocs-backend": "^0.8.2",
"@backstage/plugin-todo-backend": "^0.1.6",
"@gitbeaker/node": "^30.2.0",
"@octokit/rest": "^18.5.3",
"azure-devops-node-api": "^10.1.1",
"dockerode": "^3.2.1",
"example-app": "^0.2.30",
"example-app": "^0.2.32",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
"knex": "^0.95.1",
@@ -60,7 +60,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.6.13",
"@backstage/cli": "^0.7.0",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5"
+5 -39
View File
@@ -14,13 +14,9 @@
* limitations under the License.
*/
import { useHotCleanup } from '@backstage/backend-common';
import {
CatalogBuilder,
createRouter,
NextCatalogBuilder,
runPeriodically,
createNextRouter,
} from '@backstage/plugin-catalog-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
@@ -28,50 +24,20 @@ import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
/*
* ** WARNING **
* DO NOT enable the experimental catalog, it will brick your database migrations.
* This is solely for internal backstage development.
*/
if (process.env.EXPERIMENTAL_CATALOG === '1') {
const builder = new NextCatalogBuilder(env);
const {
entitiesCatalog,
locationAnalyzer,
processingEngine,
locationService,
} = await builder.build();
// TODO(jhaals): run and manage in background.
await processingEngine.start();
return await createNextRouter({
entitiesCatalog,
locationAnalyzer,
locationService,
logger: env.logger,
config: env.config,
});
}
const builder = new CatalogBuilder(env);
const builder = await CatalogBuilder.create(env);
const {
entitiesCatalog,
locationsCatalog,
higherOrderOperation,
locationAnalyzer,
processingEngine,
locationService,
} = await builder.build();
useHotCleanup(
module,
runPeriodically(() => higherOrderOperation.refreshAllLocations(), 100000),
);
await processingEngine.start();
return await createRouter({
entitiesCatalog,
locationsCatalog,
higherOrderOperation,
locationAnalyzer,
locationService,
logger: env.logger,
config: env.config,
});
+8
View File
@@ -1,5 +1,13 @@
# @backstage/catalog-client
## 0.3.13
### Patch Changes
- 70bc30c5b: Display preview result final step.
- Updated dependencies [27a9b503a]
- @backstage/catalog-model@0.8.2
## 0.3.12
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/catalog-client",
"version": "0.3.12",
"version": "0.3.13",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -29,13 +29,13 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/catalog-model": "^0.8.0",
"@backstage/catalog-model": "^0.8.2",
"@backstage/config": "^0.1.5",
"@backstage/errors": "^0.1.1",
"cross-fetch": "^3.0.6"
},
"devDependencies": {
"@backstage/cli": "^0.6.13",
"@backstage/cli": "^0.7.0",
"@types/jest": "^26.0.7",
"msw": "^0.21.2"
},
+22
View File
@@ -1,5 +1,27 @@
# @backstage/catalog-model
## 0.8.2
### Patch Changes
- 27a9b503a: Introduce conditional steps in scaffolder templates.
A step can now include an `if` property that only executes a step if the
condition is truthy. The condition can include handlebar templates.
```yaml
- id: register
if: '{{ not parameters.dryRun }}'
name: Register
action: catalog:register
input:
repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}'
catalogInfoPath: '/catalog-info.yaml'
```
Also introduces a `not` helper in handlebar templates that allows to negate
boolean expressions.
## 0.8.1
### Patch Changes
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/catalog-model",
"version": "0.8.1",
"version": "0.8.2",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -35,13 +35,12 @@
"@types/yup": "^0.29.8",
"ajv": "^7.0.3",
"json-schema": "^0.3.0",
"typescript-json-schema": "^0.49.0",
"lodash": "^4.17.15",
"uuid": "^8.0.0",
"yup": "^0.29.3"
},
"devDependencies": {
"@backstage/cli": "^0.6.14",
"@backstage/cli": "^0.7.0",
"@types/express": "^4.17.6",
"@types/jest": "^26.0.7",
"@types/lodash": "^4.14.151",
+53
View File
@@ -1,5 +1,58 @@
# @backstage/cli
## 0.7.0
### Minor Changes
- 9cd3c533c: Switch from `ts-jest` to `@sucrase/jest-plugin`, improving performance and aligning transpilation with bundling.
In order to switch back to `ts-jest`, install `ts-jest@^26.4.3` as a dependency in the root of your repo and add the following in the root `package.json`:
```json
"jest": {
"globals": {
"ts-jest": {
"isolatedModules": true
}
},
"transform": {
"\\.esm\\.js$": "@backstage/cli/config/jestEsmTransform.js",
"\\.(js|jsx|ts|tsx)$": "ts-jest",
"\\.(bmp|gif|jpg|jpeg|png|frag|xml|svg)$": "@backstage/cli/config/jestFileTransform.js",
"\\.(yaml)$": "yaml-jest"
}
}
```
Note that this will override the default jest transforms included with the `@backstage/cli`.
It is possible that some test code needs a small migration as a result of this change, which stems from a difference in how `sucrase` and `ts-jest` transform module re-exports.
Consider the following code:
```ts
import * as utils from './utils';
jest.spyOn(utils, 'myUtility').mockReturnValue(3);
```
If the `./utils` import for example refers to an index file that in turn re-exports from `./utils/myUtility`, you would have to change the code to the following to work around the fact that the exported object from `./utils` ends up not having configurable properties, thus breaking `jest.spyOn`.
```ts
import * as utils from './utils/myUtility';
jest.spyOn(utils, 'myUtility').mockReturnValue(3);
```
### Patch Changes
- 7f7443308: Updated dependencies
- 21e8ebef5: Fix error message formatting in the packaging process.
error.errors can be undefined which will lead to a TypeError, swallowing the actual error message in the process.
For instance, if you break your tsconfig.json with invalid syntax, backstage-cli will not be able to build anything and it will be very hard to find out why because the underlying error message is hidden behind a TypeError.
## 0.6.14
### Patch Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli",
"description": "CLI for developing Backstage plugins and apps",
"version": "0.6.14",
"version": "0.7.0",
"private": false,
"publishConfig": {
"access": "public"
@@ -94,8 +94,8 @@
"react-hot-loader": "^4.12.21",
"recursive-readdir": "^2.2.2",
"replace-in-file": "^6.0.0",
"rollup": "2.33.x",
"rollup-plugin-dts": "^2.0.1",
"rollup": "2.44.x",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-esbuild": "2.6.x",
"rollup-plugin-peer-deps-external": "^2.2.2",
"rollup-plugin-postcss": "^4.0.0",
@@ -118,7 +118,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/backend-common": "^0.8.1",
"@backstage/backend-common": "^0.8.2",
"@backstage/config": "^0.1.5",
"@backstage/core": "^0.7.12",
"@backstage/dev-utils": "^0.1.17",
@@ -139,7 +139,7 @@
"@types/rollup-plugin-postcss": "^2.0.0",
"@types/tar": "^4.0.3",
"@types/webpack": "^4.41.7",
"@types/webpack-dev-server": "3.11.0",
"@types/webpack-dev-server": "^3.11.0",
"@types/yarnpkg__lockfile": "^1.1.4",
"del": "^5.1.0",
"mock-fs": "^4.13.0",
@@ -34,9 +34,12 @@ export async function startStandaloneServer(
logger,
});
const service = createServiceBuilder(module)
.enableCors({ origin: 'http://localhost:3000' })
let service = createServiceBuilder(module)
.setPort(options.port)
.addRouter('/{{id}}', router);
if (options.enableCors) {
service = service.enableCors({ origin: 'http://localhost:3000' });
}
return await service.start().catch(err => {
logger.error(err);
+15
View File
@@ -0,0 +1,15 @@
# @backstage/codemods
## 0.1.1
### Patch Changes
- Updated dependencies [9bca2a252]
- Updated dependencies [e47336ea4]
- Updated dependencies [75b8537ce]
- Updated dependencies [da8cba44f]
- Updated dependencies [da8cba44f]
- Updated dependencies [9bca2a252]
- @backstage/core-app-api@0.1.2
- @backstage/core-components@0.1.2
- @backstage/core-plugin-api@0.1.2
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/codemods",
"description": "A collection of codemods for Backstage projects",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"homepage": "https://backstage.io",
"repository": {
+13 -2
View File
@@ -18,6 +18,7 @@ import { relative as relativePath } from 'path';
import { spawn } from 'child_process';
import { Command } from 'commander';
import { findPaths } from '@backstage/cli-common';
import { platform } from 'os';
import { ExitCodeError } from './errors';
// eslint-disable-next-line no-restricted-syntax
@@ -50,8 +51,18 @@ export function createCodemodAction(name: string) {
console.log(`Running jscodeshift with these arguments: ${args.join(' ')}`);
const jscodeshiftScript = require.resolve('.bin/jscodeshift');
const child = spawn(process.argv0, [jscodeshiftScript, ...args], {
let command;
if (platform() === 'win32') {
command = 'jscodeshift';
} else {
// jscodeshift ships a slightly broken bin script with windows
// line endings so we need to execute it using node rather than
// letting the `#!/usr/bin/env node` take care of it
command = process.argv0;
args.unshift(require.resolve('.bin/jscodeshift'));
}
const child = spawn(command, args, {
stdio: 'inherit',
shell: true,
env: {
@@ -25,7 +25,8 @@ function runTransform(source: string) {
stats: () => undefined,
report: () => undefined,
};
return coreImportTransform({ source, file: 'test.ts' }, api);
const result = coreImportTransform({ source, file: 'test.ts' }, api);
return result?.split('\r\n').join('\n');
}
describe('core-imports', () => {
+1 -1
View File
@@ -37,7 +37,7 @@
"fs-extra": "^9.0.0",
"json-schema": "^0.3.0",
"json-schema-merge-allof": "^0.8.1",
"typescript-json-schema": "^0.49.0",
"typescript-json-schema": "^0.50.1",
"yaml": "^1.9.2",
"yup": "^0.29.3"
},
@@ -28,6 +28,15 @@ const mockSchema = {
},
};
// We need to load in actual TS libraries when using mock-fs.
// This lookup is to allow the `typescript` dependency to exist either
// at top level or inside node_modules of typescript-json-schema
const typescriptModuleDir = path.dirname(
require.resolve('typescript/package.json', {
paths: [require.resolve('typescript-json-schema')],
}),
);
describe('collectConfigSchemas', () => {
afterEach(() => {
mockFs.restore();
@@ -157,9 +166,7 @@ describe('collectConfigSchemas', () => {
},
},
// TypeScript compilation needs to load some real files inside the typescript dir
'../../node_modules/typescript': (mockFs as any).load(
'../../node_modules/typescript',
),
[typescriptModuleDir]: (mockFs as any).load(typescriptModuleDir),
});
await expect(collectConfigSchemas(['a', 'b', 'c'])).resolves.toEqual([
@@ -218,9 +225,7 @@ describe('collectConfigSchemas', () => {
},
},
// TypeScript compilation needs to load some real files inside the typescript dir
'../../node_modules/typescript': (mockFs as any).load(
'../../node_modules/typescript',
),
[typescriptModuleDir]: (mockFs as any).load(typescriptModuleDir),
});
await expect(collectConfigSchemas(['a'])).rejects.toThrow(
@@ -168,23 +168,6 @@ function compileTsSchemas(paths: string[]) {
},
[path.split(sep).join('/')], // Unix paths are expected for all OSes here
) as JsonObject | null;
// This is a workaround for an API change in TypeScript 4.3 where doc comments no
// longer are represented by a single string, but instead an array of objects.
// This isn't handled by typescript-json-schema so we do the conversion here instead.
value = JSON.parse(JSON.stringify(value), (key, prop) => {
if (key === 'visibility' && Array.isArray(prop)) {
const text = prop[0]?.text;
if (!text) {
const propStr = JSON.stringify(prop);
throw new Error(
`Failed conversion of visibility schema, got ${propStr}`,
);
}
return text;
}
return prop;
});
} catch (error) {
if (error.message !== 'type Config not found') {
throw error;
+9
View File
@@ -1,5 +1,14 @@
# @backstage/core-api
## 0.2.22
### Patch Changes
- 9bca2a252: Improve forwards compatibility with `@backstage/core-app-api` and `@backstage/core-plugin-api` by re-using route reference types and factory methods from `@backstage/core-plugin-api`.
- Updated dependencies [75b8537ce]
- Updated dependencies [da8cba44f]
- @backstage/core-plugin-api@0.1.2
## 0.2.21
### Patch Changes
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-api",
"description": "Internal Core API used by Backstage plugins and apps",
"version": "0.2.21",
"version": "0.2.22",
"private": false,
"publishConfig": {
"access": "public",
@@ -30,7 +30,7 @@
},
"dependencies": {
"@backstage/config": "^0.1.4",
"@backstage/core-plugin-api": "^0.1.1",
"@backstage/core-plugin-api": "^0.1.2",
"@backstage/theme": "^0.2.8",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -43,7 +43,7 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.6.14",
"@backstage/cli": "^0.7.0",
"@backstage/test-utils": "^0.1.13",
"@backstage/test-utils-core": "^0.1.1",
"@testing-library/jest-dom": "^5.10.1",
+43
View File
@@ -1,5 +1,48 @@
# @backstage/core-app-api
## 0.1.2
### Patch Changes
- 9bca2a252: Fixes a type bug where supplying all app icons to `createApp` was required, rather than just a partial list.
- 75b8537ce: This change adds automatic error boundaries around extensions.
This means that all exposed parts of a plugin are wrapped in a general error boundary component, that is plugin aware. The default design for the error box is borrowed from `@backstage/errors`. To override the default "fallback", one must provide a component named `ErrorBoundaryFallback` to `createApp`, like so:
```ts
const app = createApp({
components: {
ErrorBoundaryFallback: props => {
// a custom fallback component
return (
<>
<h1>Oops.</h1>
<h2>
The plugin {props.plugin.getId()} failed with{' '}
{props.error.message}
</h2>
<button onClick={props.resetError}>Try again</button>
</>
);
},
},
});
```
The props here include:
- `error`. An `Error` object or something that inherits it that represents the error that was thrown from any inner component.
- `resetError`. A callback that will simply attempt to mount the children of the error boundary again.
- `plugin`. A `BackstagePlugin` that can be used to look up info to be presented in the error message. For instance, you may want to keep a map of your internal plugins and team names or slack channels and present these when an error occurs. Typically, you'll do that by getting the plugin ID with `plugin.getId()`.
- da8cba44f: Deprecate and disable the extension creation methods, which were added to this package by mistake and should only exist within `@backstage/core-plugin-api`.
- 9bca2a252: Update `createApp` options to allow plugins with unknown output types in order to improve forwards and backwards compatibility.
- Updated dependencies [e47336ea4]
- Updated dependencies [75b8537ce]
- Updated dependencies [da8cba44f]
- @backstage/core-components@0.1.2
- @backstage/core-plugin-api@0.1.2
## 0.1.1
### Patch Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-app-api",
"description": "Core app API used by Backstage apps",
"version": "0.1.1",
"version": "0.1.2",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,9 +29,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/core-components": "^0.1.1",
"@backstage/core-components": "^0.1.2",
"@backstage/config": "^0.1.3",
"@backstage/core-plugin-api": "^0.1.1",
"@backstage/core-plugin-api": "^0.1.2",
"@backstage/theme": "^0.2.8",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -44,7 +44,7 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.6.14",
"@backstage/cli": "^0.7.0",
"@backstage/test-utils": "^0.1.13",
"@backstage/test-utils-core": "^0.1.1",
"@testing-library/jest-dom": "^5.10.1",
+39
View File
@@ -1,5 +1,44 @@
# @backstage/core-components
## 0.1.2
### Patch Changes
- e47336ea4: Use app.title for helmet in header
- 75b8537ce: This change adds automatic error boundaries around extensions.
This means that all exposed parts of a plugin are wrapped in a general error boundary component, that is plugin aware. The default design for the error box is borrowed from `@backstage/errors`. To override the default "fallback", one must provide a component named `ErrorBoundaryFallback` to `createApp`, like so:
```ts
const app = createApp({
components: {
ErrorBoundaryFallback: props => {
// a custom fallback component
return (
<>
<h1>Oops.</h1>
<h2>
The plugin {props.plugin.getId()} failed with{' '}
{props.error.message}
</h2>
<button onClick={props.resetError}>Try again</button>
</>
);
},
},
});
```
The props here include:
- `error`. An `Error` object or something that inherits it that represents the error that was thrown from any inner component.
- `resetError`. A callback that will simply attempt to mount the children of the error boundary again.
- `plugin`. A `BackstagePlugin` that can be used to look up info to be presented in the error message. For instance, you may want to keep a map of your internal plugins and team names or slack channels and present these when an error occurs. Typically, you'll do that by getting the plugin ID with `plugin.getId()`.
- Updated dependencies [75b8537ce]
- Updated dependencies [da8cba44f]
- @backstage/core-plugin-api@0.1.2
## 0.1.1
### Patch Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-components",
"description": "Core components used by Backstage plugins and apps",
"version": "0.1.1",
"version": "0.1.2",
"private": false,
"publishConfig": {
"access": "public",
@@ -30,7 +30,7 @@
},
"dependencies": {
"@backstage/config": "^0.1.5",
"@backstage/core-plugin-api": "^0.1.1",
"@backstage/core-plugin-api": "^0.1.2",
"@backstage/errors": "^0.1.1",
"@backstage/theme": "^0.2.8",
"@material-ui/core": "^4.11.0",
@@ -70,8 +70,8 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/core-app-api": "^0.1.1",
"@backstage/cli": "^0.6.14",
"@backstage/core-app-api": "^0.1.2",
"@backstage/cli": "^0.7.0",
"@backstage/test-utils": "^0.1.13",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
@@ -14,17 +14,19 @@
* limitations under the License.
*/
import React, { ComponentProps } from 'react';
import { Button as MaterialButton } from '@material-ui/core';
import { Link as RouterLink } from 'react-router-dom';
import {
Button as MaterialButton,
ButtonProps as MaterialButtonProps,
} from '@material-ui/core';
import React from 'react';
import { Link, LinkProps } from '../Link';
type Props = ComponentProps<typeof MaterialButton> &
ComponentProps<typeof RouterLink>;
type Props = MaterialButtonProps & Omit<LinkProps, 'variant' | 'color'>;
/**
* Thin wrapper on top of material-ui's Button component
* Makes the Button to utilise react-router
*/
export const Button = React.forwardRef<any, Props>((props, ref) => (
<MaterialButton ref={ref} component={RouterLink} {...props} />
<MaterialButton ref={ref} component={Link} {...props} />
));
@@ -21,8 +21,9 @@ import {
RenderResult,
waitFor,
fireEvent,
screen,
} from '@testing-library/react';
import { wrapInTestApp } from '@backstage/test-utils';
import { wrapInTestApp, renderInTestApp } from '@backstage/test-utils';
import { SupportButton } from './SupportButton';
const SUPPORT_BUTTON_ID = 'support-button';
@@ -41,6 +42,12 @@ describe('<SupportButton />', () => {
);
});
it('supports passing a title', async () => {
await renderInTestApp(<SupportButton title="Custom title" />);
fireEvent.click(screen.getByTestId(SUPPORT_BUTTON_ID));
expect(screen.getByText('Custom title')).toBeInTheDocument();
});
it('shows popover on click', async () => {
let renderResult: RenderResult;
@@ -24,19 +24,18 @@ import {
ListItem,
ListItemIcon,
ListItemText,
Typography,
makeStyles,
Popover,
} from '@material-ui/core';
import React, {
Fragment,
MouseEventHandler,
PropsWithChildren,
useState,
} from 'react';
import React, { Fragment, MouseEventHandler, useState } from 'react';
import { SupportItem, SupportItemLink, useSupportConfig } from '../../hooks';
import { Link } from '../Link';
type Props = {};
type SupportButtonProps = {
title?: string;
children?: React.ReactNode;
};
const useStyles = makeStyles({
popoverList: {
@@ -78,7 +77,7 @@ const SupportListItem = ({ item }: { item: SupportItem }) => {
);
};
export const SupportButton = ({ children }: PropsWithChildren<Props>) => {
export const SupportButton = ({ title, children }: SupportButtonProps) => {
const { items } = useSupportConfig();
const [popoverOpen, setPopoverOpen] = useState(false);
@@ -121,13 +120,20 @@ export const SupportButton = ({ children }: PropsWithChildren<Props>) => {
onClose={popoverCloseHandler}
>
<List className={classes.popoverList}>
{title && (
<ListItem alignItems="flex-start">
<Typography variant="subtitle1">{title}</Typography>
</ListItem>
)}
{React.Children.map(children, (child, i) => (
<ListItem alignItems="flex-start" key={i}>
<ListItem alignItems="flex-start" key={`child-${i}`}>
{child}
</ListItem>
))}
{items &&
items.map((item, i) => <SupportListItem item={item} key={i} />)}
items.map((item, i) => (
<SupportListItem item={item} key={`item-${i}`} />
))}
</List>
<DialogActions>
<Button color="primary" onClick={popoverCloseHandler}>
+36
View File
@@ -1,5 +1,41 @@
# @backstage/core-plugin-api
## 0.1.2
### Patch Changes
- 75b8537ce: This change adds automatic error boundaries around extensions.
This means that all exposed parts of a plugin are wrapped in a general error boundary component, that is plugin aware. The default design for the error box is borrowed from `@backstage/errors`. To override the default "fallback", one must provide a component named `ErrorBoundaryFallback` to `createApp`, like so:
```ts
const app = createApp({
components: {
ErrorBoundaryFallback: props => {
// a custom fallback component
return (
<>
<h1>Oops.</h1>
<h2>
The plugin {props.plugin.getId()} failed with{' '}
{props.error.message}
</h2>
<button onClick={props.resetError}>Try again</button>
</>
);
},
},
});
```
The props here include:
- `error`. An `Error` object or something that inherits it that represents the error that was thrown from any inner component.
- `resetError`. A callback that will simply attempt to mount the children of the error boundary again.
- `plugin`. A `BackstagePlugin` that can be used to look up info to be presented in the error message. For instance, you may want to keep a map of your internal plugins and team names or slack channels and present these when an error occurs. Typically, you'll do that by getting the plugin ID with `plugin.getId()`.
- da8cba44f: Apply fixes to the extension creation API that were mistakenly applied to `@backstage/core-app-api` instead.
## 0.1.1
### Patch Changes

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