Merge branch 'master' into useRelatedEntities-batches

This commit is contained in:
Will Sewell
2021-05-03 15:15:24 +01:00
37 changed files with 1432 additions and 115 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/backend-common': patch
'@backstage/create-app': patch
'@backstage/integration': patch
'@backstage/plugin-catalog-import': patch
'@backstage/plugin-github-actions': patch
'@backstage/plugin-scaffolder-backend': patch
---
The default `@octokit/rest` dependency was bumped to `"^18.5.3"`.
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/cli': patch
'@backstage/core': patch
---
Fix some transitive dependency warnings in yarn
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core': patch
'@backstage/plugin-catalog-import': patch
---
Bump react-hook-form version to be the same for the entire project.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Added lax option to backstage-cli app:build command
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-api-docs': patch
---
Add support for displaying JSON schemas.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Add support for non-organization accounts in GitHub Discovery
+3
View File
@@ -111,6 +111,7 @@ Usage: backstage-cli app:build
Options:
--stats Write bundle stats to output directory
--lax Do not require environment variables to be set
--config <path> Config files to load instead of app-config.yaml (default: [])
-h, --help display help for command
```
@@ -486,6 +487,7 @@ Usage: backstage-cli config:print [options]
Options:
--package <name> Only load config schema that applies to the given package
--lax Do not require environment variables to be set
--frontend Print only the frontend configuration
--with-secrets Include secrets in the printed configuration
--format <format> Format to print the configuration in, either json or yaml [yaml]
@@ -506,6 +508,7 @@ Usage: backstage-cli config:check [options]
Options:
--package <name> Only load config schema that applies to the given package
--lax Do not require environment variables to be set
--config <path> Config files to load instead of app-config.yaml (default: [])
-h, --help display help for command
```
@@ -37,6 +37,13 @@ The locations added through static configuration cannot be removed through the
catalog locations API. To remove these locations, you must remove them from the
configuration.
Syntax errors or other types of errors present in `catalog-info.yaml` files will
be logged for investigation. Errors do not cause processing to abort.
When multiple `catalog-info.yaml` files with the same `metadata.name` property
are discovered, one will be processed and all others will be skipped. This
action is logged for further investigation.
### Integration Processors
Integrations may simply provide a mechanism to handle `url` location type for an
+1 -1
View File
@@ -39,7 +39,7 @@
"@backstage/theme": "^0.2.6",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"@roadiehq/backstage-plugin-buildkite": "^1.0.0",
"@roadiehq/backstage-plugin-github-insights": "^1.0.0",
"@roadiehq/backstage-plugin-github-pull-requests": "^1.0.0",
+1 -1
View File
@@ -35,7 +35,7 @@
"@backstage/errors": "^0.1.1",
"@backstage/integration": "^0.5.1",
"@google-cloud/storage": "^5.8.0",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"@types/cors": "^2.8.6",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
+1 -1
View File
@@ -47,7 +47,7 @@
"@backstage/plugin-techdocs-backend": "^0.7.0",
"@backstage/plugin-todo-backend": "^0.1.3",
"@gitbeaker/node": "^28.0.2",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"azure-devops-node-api": "^10.1.1",
"dockerode": "^3.2.1",
"example-app": "^0.2.25",
@@ -5,6 +5,7 @@ metadata:
description: A collection of all Backstage example APIs
spec:
targets:
- ./apis/config-schema-api.yaml
- ./apis/hello-world-api.yaml
- ./apis/petstore-api.yaml
- ./apis/spotify-api.yaml
@@ -0,0 +1,11 @@
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: config-schema
description: A Backstage config schemas.
spec:
type: jsonschema
lifecycle: production
owner: team-a
definition:
$text: https://github.com/backstage/backstage/blob/master/plugins/config-schema/dev/example-schema.json
+1
View File
@@ -86,6 +86,7 @@
"lodash": "^4.17.19",
"mini-css-extract-plugin": "^0.9.0",
"ora": "^5.3.0",
"postcss": "^8.1.0",
"raw-loader": "^4.0.1",
"react": "^16.0.0",
"react-dev-utils": "^11.0.4",
+1
View File
@@ -30,6 +30,7 @@ export default async (cmd: Command) => {
...(await loadCliConfig({
args: cmd.config,
fromPackage: name,
mockEnv: cmd.lax,
})),
});
};
+1
View File
@@ -29,6 +29,7 @@ export function registerCommands(program: CommanderStatic) {
.command('app:build')
.description('Build an app for a production release')
.option('--stats', 'Write bundle stats to output directory')
.option('--lax', 'Do not require environment variables to be set')
.option(...configOption)
.action(lazy(() => import('./app/build').then(m => m.default)));
+2 -1
View File
@@ -48,6 +48,7 @@
"d3-shape": "^2.0.0",
"d3-zoom": "^2.0.0",
"dagre": "^0.8.5",
"history": "^5.0.0",
"immer": "^9.0.1",
"lodash": "^4.17.15",
"material-table": "^1.69.1",
@@ -57,7 +58,7 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "6.1.0",
"react-hook-form": "^6.6.0",
"react-hook-form": "^6.15.4",
"react-markdown": "^5.0.2",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
@@ -29,7 +29,7 @@
"@backstage/plugin-scaffolder-backend": "^{{version '@backstage/plugin-scaffolder-backend'}}",
"@backstage/plugin-techdocs-backend": "^{{version '@backstage/plugin-techdocs-backend'}}",
"@gitbeaker/node": "^28.0.2",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"dockerode": "^3.2.1",
"express": "^4.17.1",
"express-promise-router": "^4.1.0",
+2 -2
View File
@@ -32,8 +32,8 @@
"@backstage/config": "^0.1.2",
"cross-fetch": "^3.0.6",
"git-url-parse": "^11.4.4",
"@octokit/rest": "^18.0.12",
"@octokit/auth-app": "^2.10.5",
"@octokit/rest": "^18.5.3",
"@octokit/auth-app": "^3.4.0",
"luxon": "^1.25.0"
},
"devDependencies": {
+3 -1
View File
@@ -14,7 +14,9 @@
]
},
"dependencies": {
"@backstage/theme": "^0.2.0"
"@backstage/theme": "^0.2.0",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"@storybook/addon-actions": "^6.1.11",
+1
View File
@@ -15,6 +15,7 @@ Right now, the following API formats are supported:
- [OpenAPI](https://swagger.io/specification/) 2 & 3
- [AsyncAPI](https://www.asyncapi.com/docs/specifications/latest/)
- [GraphQL](https://graphql.org/learn/schema/)
- [JSON Schema](https://json-schema.org/)
Other formats are displayed as plain text, but this can easily be extended.
+15
View File
@@ -27,6 +27,7 @@ import {
} from '../src';
import asyncapiApiEntity from './asyncapi-example-api.yaml';
import graphqlApiEntity from './graphql-example-api.yaml';
import jsonschemaApiEntity from './jsonschema-example-api.yaml';
import openapiApiEntity from './openapi-example-api.yaml';
import otherApiEntity from './other-example-api.yaml';
@@ -41,6 +42,7 @@ createDevApp()
items: [
openapiApiEntity,
asyncapiApiEntity,
jsonschemaApiEntity,
graphqlApiEntity,
otherApiEntity,
],
@@ -87,6 +89,19 @@ createDevApp()
</Page>
),
})
.addPage({
title: 'JSON Schema',
element: (
<Page themeId="home">
<Header title="JSON Schema" />
<Content>
<EntityProvider entity={(jsonschemaApiEntity as any) as Entity}>
<EntityApiDefinitionCard />
</EntityProvider>
</Content>
</Page>
),
})
.addPage({
title: 'GraphQL',
element: (
@@ -0,0 +1,32 @@
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: persons
description: Person dataset
spec:
type: jsonschema
lifecycle: experimental
owner: team-c
# From https://json-schema.org/learn/miscellaneous-examples.html
definition: |
{
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
+3
View File
@@ -38,6 +38,9 @@
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@stoplight/json-schema-viewer": "^4.0.0-beta.16",
"@stoplight/mosaic": "^1.0.0-beta.46",
"@stoplight/reporter": "^1.10.0",
"@types/react": "^16.9",
"graphiql": "^1.0.0-alpha.10",
"graphql": "^15.3.0",
@@ -16,6 +16,7 @@
import React from 'react';
import { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget';
import { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget';
import { JsonSchemaDefinitionWidget } from '../JsonSchemaDefinitionWidget';
import { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget';
export type ApiDefinitionWidget = {
@@ -51,5 +52,13 @@ export function defaultDefinitionWidgets(): ApiDefinitionWidget[] {
<GraphQlDefinitionWidget definition={definition} />
),
},
{
type: 'jsonschema',
title: 'JSON Schema',
rawLanguage: 'json',
component: definition => (
<JsonSchemaDefinitionWidget definition={definition} />
),
},
];
}
@@ -0,0 +1,61 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { renderInTestApp } from '@backstage/test-utils';
import React from 'react';
import { JsonSchemaDefinitionWidget } from './JsonSchemaDefinitionWidget';
describe('<JsonSchemaDefinitionWidget />', () => {
it('renders json schema', async () => {
// From https://json-schema.org/learn/miscellaneous-examples.html
const definition = `
{
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
`;
const { getByText } = await renderInTestApp(
<JsonSchemaDefinitionWidget definition={definition} />,
);
expect(getByText(/lastName/i)).toBeInTheDocument();
expect(getByText(/The person's last name./i)).toBeInTheDocument();
});
it('renders error if definition is missing', async () => {
const { getByText } = await renderInTestApp(
<JsonSchemaDefinitionWidget definition="{}" />,
);
expect(getByText(/No schema defined/i)).toBeInTheDocument();
});
});
@@ -0,0 +1,50 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useTheme } from '@material-ui/core';
import { JsonSchemaViewer } from '@stoplight/json-schema-viewer';
import { injectStyles, useThemeStore } from '@stoplight/mosaic';
import React, { useMemo } from 'react';
import { useEffectOnce } from 'react-use';
injectStyles();
type Props = {
definition: any;
};
export const JsonSchemaDefinitionWidget = ({ definition }: Props) => {
const schema = useMemo(() => JSON.parse(definition), [definition]);
const theme = useTheme();
const themeStore = useThemeStore();
useEffectOnce(() => {
themeStore.setColor('background', theme.palette.background.paper);
themeStore.setColor('text', theme.palette.text.primary);
themeStore.setColor('primary', theme.palette.primary.main);
themeStore.setColor('success', theme.palette.success.main);
themeStore.setColor('warning', theme.palette.warning.main);
themeStore.setColor('danger', theme.palette.error.main);
themeStore.setMode(theme.palette.type);
});
return (
<JsonSchemaViewer
schema={schema}
emptyText="No schema defined"
defaultExpandedDepth={5}
/>
);
};
@@ -0,0 +1,17 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { JsonSchemaDefinitionWidget } from './JsonSchemaDefinitionWidget';
+1
View File
@@ -20,3 +20,4 @@ export * from './AsyncApiDefinitionWidget';
export * from './ComponentsCards';
export * from './OpenApiDefinitionWidget';
export * from './PlainApiDefinitionWidget';
export * from './JsonSchemaDefinitionWidget';
@@ -156,7 +156,7 @@ describe('github', () => {
describe('getOrganizationRepositories', () => {
it('read repositories', async () => {
const input: QueryResponse = {
organization: {
repositoryOwner: {
repositories: {
nodes: [
{
@@ -20,7 +20,8 @@ import { graphql } from '@octokit/graphql';
// Graphql types
export type QueryResponse = {
organization: Organization;
organization?: Organization;
repositoryOwner?: Organization | User;
};
export type Organization = {
@@ -41,6 +42,7 @@ export type User = {
avatarUrl?: string;
email?: string;
name?: string;
repositories?: Connection<Repository>;
};
export type Team = {
@@ -228,28 +230,27 @@ export async function getOrganizationRepositories(
org: string,
): Promise<{ repositories: Repository[] }> {
const query = `
query repositories($org: String!, $cursor: String) {
organization(login: $org) {
name
repositories(first: 100, after: $cursor) {
nodes {
name
url
isArchived
}
pageInfo {
hasNextPage
endCursor
query repositories($org: String!, $cursor: String) {
repositoryOwner(login: $org) {
login
repositories(first: 100, after: $cursor) {
nodes {
name
url
isArchived
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
`;
}`;
const repositories = await queryWithPaging(
client,
query,
r => r.organization?.repositories,
r => r.repositoryOwner?.repositories,
x => x,
{ org },
);
+1 -1
View File
@@ -40,7 +40,7 @@
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"@types/react": "^16.9",
"git-url-parse": "^11.4.4",
"js-base64": "^3.6.0",
+1 -1
View File
@@ -40,7 +40,7 @@
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"moment": "^2.27.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
@@ -202,13 +202,13 @@ export const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {
<TableCell>
<Typography noWrap>Message</Typography>
</TableCell>
<TableCell>{details.value?.head_commit.message}</TableCell>
<TableCell>{details.value?.head_commit?.message}</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Typography noWrap>Commit ID</Typography>
</TableCell>
<TableCell>{details.value?.head_commit.id}</TableCell>
<TableCell>{details.value?.head_commit?.id}</TableCell>
</TableRow>
<TableRow>
<TableCell>
@@ -231,7 +231,7 @@ export const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {
<TableCell>
<Typography noWrap>Author</Typography>
</TableCell>
<TableCell>{`${details.value?.head_commit.author?.name} (${details.value?.head_commit.author?.email})`}</TableCell>
<TableCell>{`${details.value?.head_commit?.author?.name} (${details.value?.head_commit?.author?.email})`}</TableCell>
</TableRow>
<TableRow>
<TableCell>
+1 -1
View File
@@ -39,7 +39,7 @@
"@material-ui/lab": "4.0.0-alpha.45",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hook-form": "^6.6.0",
"react-hook-form": "^6.15.4",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^15.3.3"
+1 -1
View File
@@ -37,7 +37,7 @@
"@backstage/integration": "^0.5.1",
"@gitbeaker/core": "^28.0.2",
"@gitbeaker/node": "^28.0.2",
"@octokit/rest": "^18.0.12",
"@octokit/rest": "^18.5.3",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
"@types/git-url-parse": "^9.0.0",
+1144 -82
View File
File diff suppressed because it is too large Load Diff