Merge branch 'master' into scalable-sidebar-new-implementation

This commit is contained in:
hiba-aldalaty
2021-11-02 09:39:49 +00:00
265 changed files with 6907 additions and 1267 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Switched to dynamically determining the packages that are unsafe to repack when executing the CLI within the Backstage main repo.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-kubernetes': patch
---
The Kubernetes plugin will now re-fetch the kubernetes objects every ten seconds (not current configurable), this allows users to track the progress of deployments without refreshing the browser.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-sentry': patch
---
feature: sentry-plugin allows passing search query for listing issues
-9
View File
@@ -1,9 +0,0 @@
---
'@backstage/test-utils': patch
'@backstage/test-utils-core': patch
---
Migrates all utility methods from `test-utils-core` into `test-utils` and delete exports from the old package.
This should have no impact since this package is considered internal and have no usages outside core packages.
Notable changes are that the testing tool `msw.setupDefaultHandlers()` have been deprecated in favour of `setupRequestMockHandlers()`.
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/core-components': patch
'@backstage/theme': patch
---
Will Add warning variant to `DismissableBanner` component.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-techdocs': patch
---
Reader will now scroll to the top of the page when navigating between pages
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
Update usage of msw in default plugin template
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/config': patch
---
Minor exports cleanup
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/theme': patch
---
More theme API cleanup
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder': patch
---
Surfacing all components of the ScaffolderPage outside of the plugin so you can customize the page
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli-common': patch
---
Add docs to the last export of cli-common
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/cli': patch
---
bump `@spotify/eslint-config-base` from 9.0.2 to 12.0.0
-10
View File
@@ -1,10 +0,0 @@
---
'@backstage/plugin-azure-devops': patch
---
Azure DevOps frontend refactoring items from issue #7641
- Remove backend setup documentation and linked to the Azure DevOps backend plugin for these instructions
- Improved documentation to be easier to expand with new features in the future
- Removed Router based on feedback from maintainers
- Added tests for `getBuildResultComponent` and `getBuildStateComponent` from the BuildTable
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder': patch
---
Scaffolder: Enable back Template action buttons if template fails to execute
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-azure-devops-backend': patch
---
Added duration (startTime and finishTime) and identity (uniqueName) to the RepoBuild results. Also did a bit of refactoring to help finish up the backend items in issue #7641
-7
View File
@@ -1,7 +0,0 @@
---
'@backstage/errors': patch
'@backstage/integration': patch
'@backstage/theme': patch
---
More API fixes: mark things public, add docs, fix exports
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kafka': patch
---
Use IdentityApi to provide Auth Token for KafkaBackendClient Api calls
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/test-utils': patch
---
Update Keyboard deprecation with a link to the recommended successor
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Expose some classes and interfaces public so TaskWorkers can run externally from the scaffolder API.
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/backend-common': patch
---
Adjusted some API exports
-6
View File
@@ -1,6 +0,0 @@
---
'@backstage/cli': patch
'@backstage/test-utils': patch
---
Bump `msw` to `v0.35.0` to resolve [CVE-2021-32796](https://github.com/advisories/GHSA-5fg8-2547-mr8q).
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
Updates the d3 dependencies
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/integration-react': patch
---
Clean up the API exports
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-catalog-react': patch
---
EntityTypePicker can be hidden and have an initial filter value set, similar to EntityKindPicker
-26
View File
@@ -1,26 +0,0 @@
---
'@backstage/backend-common': patch
'@backstage/catalog-model': patch
'@backstage/cli': patch
'@backstage/config-loader': patch
'@backstage/core-app-api': patch
'@backstage/errors': patch
'@backstage/search-common': patch
'@backstage/test-utils': patch
'@backstage/plugin-app-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-catalog-backend-module-ldap': patch
'@backstage/plugin-catalog-graphql': patch
'@backstage/plugin-catalog-react': patch
'@backstage/plugin-config-schema': patch
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-scaffolder-backend': patch
'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch
'@backstage/plugin-scaffolder-backend-module-rails': patch
'@backstage/plugin-scaffolder-backend-module-yeoman': patch
'@backstage/plugin-scaffolder-common': patch
'@backstage/plugin-search': patch
'@backstage/plugin-shortcuts': patch
---
Switch to use the json and observable types from `@backstage/types`
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/techdocs-common': patch
---
Support optional bucketRootPath configuration parameter in S3 and GCS publishers
-8
View File
@@ -1,8 +0,0 @@
---
'@backstage/config': patch
'@backstage/core-app-api': patch
'@backstage/core-plugin-api': patch
'@backstage/plugin-scaffolder-backend': patch
---
Start using the new `@backstage/types` package. Initially, this means using the `Observable` and `Json*` types from there. The types also remain in their old places but deprecated, and will be removed in a future release.
-7
View File
@@ -1,7 +0,0 @@
---
'@backstage/config': patch
'@backstage/core-app-api': patch
'@backstage/core-plugin-api': patch
---
Replace usage of test-utils-core with test-utils
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-search-backend-node': patch
---
Handle special case when filter array has single value optimizing Lunr search behaviour.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-app-api': patch
---
I have added default icons for the catalog, scaffolder, techdocs, and search.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/techdocs-common': patch
---
Default TechDocs container used at docs generation-time is now [v0.3.5](https://github.com/backstage/techdocs-container/releases/tag/v0.3.5).
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-sentry': patch
---
fix: sentry-plugin correction for allowed period values
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-app-api': patch
---
Api cleanup, adding `@public` where necessary and tweaking some comments
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Fixed bug where the mode of an executable file was ignored
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/core-components': patch
---
Deprecated `DismissbleBannerClassKey` and fixed the typo to make `DismissableBannerClassKey`
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/errors': patch
---
Add `stringifyError` that is useful for logging e.g. `Something went wrong, ${stringifyError(e)}`
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/config-loader': patch
---
bump `typescript-json-schema` from 0.50.1 to 0.51.0
+2
View File
@@ -40,6 +40,8 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: setup chrome
uses: browser-actions/setup-chrome@latest
- name: yarn install
run: yarn install --frozen-lockfile
+2 -5
View File
@@ -53,6 +53,8 @@ jobs:
id: yarn-cache
if: steps.cache-modules.outputs.cache-hit != 'true'
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: setup chrome
uses: browser-actions/setup-chrome@latest
- name: cache global yarn cache
uses: actions/cache@v2
if: steps.cache-modules.outputs.cache-hit != 'true'
@@ -72,8 +74,3 @@ jobs:
run: |
sudo sysctl fs.inotify.max_user_watches=524288
yarn e2e-test run
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
+2
View File
@@ -2,6 +2,8 @@
# [Backstage](https://backstage.io)
> 🏖 All of the maintainers will be taking a wellness break Nov. 15. The repo and Discord may be quieter than usual, but not to worry. Well have coverage plans in place and be back in full force, rested and restored, on Nov. 8. 🏖
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![CNCF Status](https://img.shields.io/badge/cncf%20status-sandbox-blue.svg)](https://www.cncf.io/projects)
[![Main CI Build](https://github.com/backstage/backstage/workflows/Main%20Master%20Build/badge.svg)](https://github.com/backstage/backstage/actions?query=workflow%3A%22Main+Master+Build%22)
@@ -502,6 +502,8 @@ spec:
lifecycle: production
owner: artist-relations-team
system: artist-engagement-portal
dependsOn:
- resource:default/artists-db
providesApis:
- artist-api
```
@@ -27,20 +27,27 @@ You can create your own Field Extension by using the
```tsx
//packages/app/scaffolder/MyCustomExtension/MyCustomExtension.tsx
import React from 'react';
import { FieldProps, FieldValidation } from '@rjsf/core';
import FormControl from '@material-ui/core/FormControl';
import { KubernetesValidatorFunctions } from '@backstage/catalog-model';
/*
This is the actual component that will get rendered in the form
*/
export const MyCustomExtension = ({ onChange, required }: FieldProps<string>) => {
export const MyCustomExtension = ({
onChange,
rawErrors,
required,
formData,
}: FieldProps<string>) => {
return (
<FormControl
<FormControl
margin="normal"
required={required}
error={rawErrors?.length > 0 && !formData}
onChange={onChange}
>
)
/>
);
};
/*
@@ -63,10 +70,10 @@ export const myCustomValidation = (
```tsx
// packages/app/scaffolder/MyCustomExtension/extensions.ts
/*
/*
This is where the magic happens and creates the custom field extension.
Note that if you're writing extensions part of a separate plugin,
Note that if you're writing extensions part of a separate plugin,
then please use `plugin.provide` from there instead and export it part of your `plugin.ts` rather than re-using the `scaffolder.plugin`.
*/
+14
View File
@@ -1,5 +1,19 @@
# @backstage/backend-common
## 0.9.8
### Patch Changes
- 96cfa561eb: Adjusted some API exports
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- 1be8d2abdb: Any set configurations which have been tagged with a visibility 'secret', are now redacted from log lines.
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/cli-common@0.1.5
- @backstage/errors@0.1.4
- @backstage/integration@0.6.9
- @backstage/config-loader@0.7.1
## 0.9.7
### Patch Changes
+9 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-common",
"description": "Common functionality library for Backstage backends",
"version": "0.9.7",
"version": "0.9.8",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -29,13 +29,14 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/cli-common": "^0.1.4",
"@backstage/config": "^0.1.10",
"@backstage/config-loader": "^0.7.0",
"@backstage/errors": "^0.1.3",
"@backstage/integration": "^0.6.7",
"@backstage/cli-common": "^0.1.5",
"@backstage/config": "^0.1.11",
"@backstage/config-loader": "^0.7.1",
"@backstage/errors": "^0.1.4",
"@backstage/integration": "^0.6.9",
"@backstage/types": "^0.1.1",
"@google-cloud/storage": "^5.8.0",
"@lerna/project": "^4.0.0",
"@octokit/rest": "^18.5.3",
"@types/cors": "^2.8.6",
"@types/dockerode": "^3.2.1",
@@ -78,8 +79,8 @@
}
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/test-utils": "^0.1.18",
"@backstage/cli": "^0.8.1",
"@backstage/test-utils": "^0.1.20",
"@types/archiver": "^5.1.0",
"@types/compression": "^1.7.0",
"@types/concat-stream": "^1.6.0",
+46 -4
View File
@@ -18,9 +18,38 @@ import { resolve as resolvePath } from 'path';
import parseArgs from 'minimist';
import { Logger } from 'winston';
import { findPaths } from '@backstage/cli-common';
import { Config, ConfigReader } from '@backstage/config';
import {
loadConfigSchema,
loadConfig,
ConfigSchema,
} from '@backstage/config-loader';
import { AppConfig, Config, ConfigReader } from '@backstage/config';
import { JsonValue } from '@backstage/types';
import { loadConfig } from '@backstage/config-loader';
import { setRootLoggerRedactionList } from './logging/rootLogger';
// Fetch the schema and get all the secrets to pass to the rootLogger for redaction
const updateRedactionList = (
schema: ConfigSchema,
configs: AppConfig[],
logger: Logger,
) => {
const secretAppConfigs = schema.process(configs, { visibility: ['secret'] });
const secretConfig = ConfigReader.fromConfigs(secretAppConfigs);
const values = new Set<string>();
const data = secretConfig.get();
JSON.parse(
JSON.stringify(data),
(_, v) => typeof v === 'string' && values.add(v),
);
logger.info(
`${values.size} secrets found in the config which will be redacted`,
);
setRootLoggerRedactionList(Array.from(values));
};
export class ObservableConfigProxy implements Config {
private config: Config = new ConfigReader({});
@@ -151,11 +180,20 @@ export async function loadBackendConfig(options: {
const args = parseArgs(options.argv);
const configPaths: string[] = [args.config ?? []].flat();
const config = new ObservableConfigProxy(options.logger);
/* eslint-disable-next-line no-restricted-syntax */
const paths = findPaths(__dirname);
// TODO(hhogg): This is fetching _all_ of the packages of the monorepo
// in order to find the secrets for redactions, however we only care about
// the backend ones, we need to find a way to exclude the frontend packages.
const { Project } = require('@lerna/project');
const project = new Project(paths.targetDir);
const packages = await project.getPackages();
const schema = await loadConfigSchema({
dependencies: packages.map((p: any) => p.name),
});
const config = new ObservableConfigProxy(options.logger);
const configs = await loadConfig({
configRoot: paths.targetRoot,
configPaths: configPaths.map(opt => resolvePath(opt)),
@@ -187,5 +225,9 @@ export async function loadBackendConfig(options: {
config.setConfig(ConfigReader.fromConfigs(configs));
// Subscribe to config changes and update the redaction list for logging
updateRedactionList(schema, configs, options.logger);
config.subscribe(() => updateRedactionList(schema, configs, options.logger));
return config;
}
+1 -1
View File
@@ -15,5 +15,5 @@
*/
export * from './formats';
export * from './rootLogger';
export { createRootLogger, getRootLogger, setRootLogger } from './rootLogger';
export * from './voidLogger';
@@ -15,7 +15,12 @@
*/
import * as winston from 'winston';
import { createRootLogger, getRootLogger, setRootLogger } from './rootLogger';
import {
createRootLogger,
getRootLogger,
setRootLogger,
setRootLoggerRedactionList,
} from './rootLogger';
describe('rootLogger', () => {
it('can replace the default logger', () => {
@@ -30,7 +35,20 @@ describe('rootLogger', () => {
);
});
describe('createRootLoger', () => {
it('redacts given secrets', () => {
const logger = createRootLogger();
jest.spyOn(logger, 'write');
setRootLoggerRedactionList(['SECRET-1', 'SECRET_2', 'SECRET.3']);
logger.info('Logging SECRET-1 and SECRET_2 and SECRET.3');
expect(logger.write).toHaveBeenCalledWith(
expect.objectContaining({
message: 'Logging [REDACTED] and [REDACTED] and [REDACTED]',
}),
);
});
describe('createRootLogger', () => {
it('creates a new logger', () => {
const oldLogger = getRootLogger();
const newLogger = createRootLogger();
@@ -18,8 +18,10 @@ import { merge } from 'lodash';
import * as winston from 'winston';
import { LoggerOptions } from 'winston';
import { coloredFormat } from './formats';
import { escapeRegExp } from '../util/escapeRegExp';
let rootLogger: winston.Logger;
let redactionRegExp: RegExp;
/** @public */
export function getRootLogger(): winston.Logger {
@@ -31,6 +33,30 @@ export function setRootLogger(newLogger: winston.Logger) {
rootLogger = newLogger;
}
export function setRootLoggerRedactionList(redactionList: string[]) {
if (redactionList.length) {
redactionRegExp = new RegExp(
`(${redactionList.map(escapeRegExp).join('|')})`,
'g',
);
}
}
/**
* A winston formatting function that finds occurrences of filteredKeys
* and replaces them with the corresponding identifier.
*/
function redactLogLine(info: winston.Logform.TransformableInfo) {
// TODO(hhogg): The logger is created before the config is loaded,
// because the logger is needed in the config loader. There is a risk of
// a secret being logged out during the config loading stage.
if (redactionRegExp) {
info.message = info.message.replace(redactionRegExp, '[REDACTED]');
}
return info;
}
/** @public */
export function createRootLogger(
options: winston.LoggerOptions = {},
@@ -41,6 +67,7 @@ export function createRootLogger(
{
level: env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format(redactLogLine)(),
env.NODE_ENV === 'production' ? winston.format.json() : coloredFormat,
),
defaultMeta: {
@@ -0,0 +1,84 @@
/*
* 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.
*/
import { escapeRegExp } from './escapeRegExp';
describe('escapeRegExp', () => {
test('does not escape non-regex characters', () => {
expect(escapeRegExp('Backstage Backstage')).toBe('Backstage Backstage');
});
test('all the characters', () => {
expect(escapeRegExp('^$\\.*+?()[]{}|')).toBe(
'\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|',
);
});
test('character: ^', () => {
expect(escapeRegExp('^')).toBe('\\^');
});
test('character: $', () => {
expect(escapeRegExp('$')).toBe('\\$');
});
test('character: \\', () => {
expect(escapeRegExp('\\')).toBe('\\\\');
});
test('character: .', () => {
expect(escapeRegExp('.')).toBe('\\.');
});
test('character: *', () => {
expect(escapeRegExp('*')).toBe('\\*');
});
test('character: +', () => {
expect(escapeRegExp('+')).toBe('\\+');
});
test('character: ?', () => {
expect(escapeRegExp('?')).toBe('\\?');
});
test('character: (', () => {
expect(escapeRegExp('(')).toBe('\\(');
});
test('character: )', () => {
expect(escapeRegExp(')')).toBe('\\)');
});
test('character: [', () => {
expect(escapeRegExp('[')).toBe('\\[');
});
test('character: ]', () => {
expect(escapeRegExp(']')).toBe('\\]');
});
test('character: {', () => {
expect(escapeRegExp('{')).toBe('\\{');
});
test('character: }', () => {
expect(escapeRegExp('}')).toBe('\\}');
});
test('character: |', () => {
expect(escapeRegExp('|')).toBe('\\|');
});
});
@@ -0,0 +1,24 @@
/*
* 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.
*/
/**
* Escapes a given string to be used inside a RegExp.
*
* Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
*/
export const escapeRegExp = (text: string) => {
return text.replace(/[.*+?^${}(\)|[\]\\]/g, '\\$&');
};
+3
View File
@@ -48,6 +48,9 @@
"@backstage/plugin-search-backend-module-elasticsearch": "^0.0.4",
"@backstage/plugin-search-backend-module-pg": "^0.2.1",
"@backstage/plugin-techdocs-backend": "^0.10.5",
"@backstage/plugin-tech-insights-backend": "^0.1.0",
"@backstage/plugin-tech-insights-node": "^0.1.0",
"@backstage/plugin-tech-insights-backend-module-jsonfc": "^0.1.0",
"@backstage/plugin-todo-backend": "^0.1.13",
"@gitbeaker/node": "^30.2.0",
"@octokit/rest": "^18.5.3",
+5
View File
@@ -53,6 +53,7 @@ import graphql from './plugins/graphql';
import app from './plugins/app';
import badges from './plugins/badges';
import jenkins from './plugins/jenkins';
import techInsights from './plugins/techInsights';
import { PluginEnvironment } from './types';
function makeCreateEnv(config: Config) {
@@ -107,12 +108,16 @@ async function main() {
const appEnv = useHotMemoize(module, () => createEnv('app'));
const badgesEnv = useHotMemoize(module, () => createEnv('badges'));
const jenkinsEnv = useHotMemoize(module, () => createEnv('jenkins'));
const techInsightsEnv = useHotMemoize(module, () =>
createEnv('tech-insights'),
);
const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
apiRouter.use('/code-coverage', await codeCoverage(codeCoverageEnv));
apiRouter.use('/rollbar', await rollbar(rollbarEnv));
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
apiRouter.use('/tech-insights', await techInsights(techInsightsEnv));
apiRouter.use('/auth', await auth(authEnv));
apiRouter.use('/azure-devops', await azureDevOps(azureDevOpsEnv));
apiRouter.use('/search', await search(searchEnv));
@@ -0,0 +1,107 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
createRouter,
buildTechInsightsContext,
createFactRetrieverRegistration,
} from '@backstage/plugin-tech-insights-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
import { CatalogClient } from '@backstage/catalog-client';
import {
JsonRulesEngineFactCheckerFactory,
JSON_RULE_ENGINE_CHECK_TYPE,
} from '@backstage/plugin-tech-insights-backend-module-jsonfc';
export default async function createPlugin({
logger,
config,
discovery,
database,
}: PluginEnvironment): Promise<Router> {
const techInsightsContext = await buildTechInsightsContext({
logger,
config,
database,
discovery,
factRetrievers: [
createFactRetrieverRegistration('5 4 * * 6', {
// Example cron, At 04:05 on Saturday.
id: 'testRetriever',
version: '1.1.2',
entityFilter: [{ kind: 'component' }], // EntityFilter to be used in the future (creating checks, graphs etc.) to figure out which entities this fact retrieves data for.
schema: {
examplenumberfact: {
type: 'integer',
description: 'Example fact returning a number',
},
},
handler: async _ctx => {
const catalogClient = new CatalogClient({
discoveryApi: discovery,
});
const entities = await catalogClient.getEntities({
filter: [{ kind: 'component' }],
});
return Promise.resolve(
entities.items.map(it => {
return {
entity: {
namespace: it.metadata.namespace!!,
kind: it.kind,
name: it.metadata.name,
},
facts: {
examplenumberfact: 2,
},
};
}),
);
},
}),
],
factCheckerFactory: new JsonRulesEngineFactCheckerFactory({
checks: [
{
id: 'simpleTestCheck',
type: JSON_RULE_ENGINE_CHECK_TYPE,
name: 'simpleTestCheck',
description: 'Simple Check For Testing',
factIds: ['testRetriever'],
rule: {
conditions: {
all: [
{
fact: 'examplenumberfact',
operator: 'lessThan',
value: 5,
},
],
},
},
},
],
logger,
}),
});
return await createRouter({
...techInsightsContext,
logger,
config,
});
}
+9
View File
@@ -1,5 +1,14 @@
# @backstage/catalog-model
## 0.9.6
### Patch Changes
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/errors@0.1.4
## 0.9.5
### Patch Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/catalog-model",
"description": "Types and validators that help describe the model of a Backstage Catalog",
"version": "0.9.5",
"version": "0.9.6",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,8 +30,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/config": "^0.1.10",
"@backstage/errors": "^0.1.3",
"@backstage/config": "^0.1.11",
"@backstage/errors": "^0.1.4",
"@backstage/types": "^0.1.1",
"@types/json-schema": "^7.0.5",
"@types/yup": "^0.29.13",
@@ -42,7 +42,7 @@
"yup": "^0.32.9"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/cli": "^0.8.1",
"@types/jest": "^26.0.7",
"@types/lodash": "^4.14.151",
"yaml": "^1.9.2"
+6
View File
@@ -1,5 +1,11 @@
# @backstage/cli-common
## 0.1.5
### Patch Changes
- c2d50a0073: Add docs to the last export of cli-common
## 0.1.4
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli-common",
"description": "Common functionality used by cli, backend, and create-app",
"version": "0.1.4",
"version": "0.1.5",
"private": false,
"main": "src/index.ts",
"types": "src/index.ts",
+14
View File
@@ -1,5 +1,19 @@
# @backstage/cli
## 0.8.1
### Patch Changes
- f1e96dc5b1: Update usage of msw in default plugin template
- b0dc1fd241: bump `@spotify/eslint-config-base` from 9.0.2 to 12.0.0
- c5bb1df55d: Bump `msw` to `v0.35.0` to resolve [CVE-2021-32796](https://github.com/advisories/GHSA-5fg8-2547-mr8q).
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/cli-common@0.1.5
- @backstage/errors@0.1.4
- @backstage/config-loader@0.7.1
## 0.8.0
### Minor Changes
+12 -12
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli",
"description": "CLI for developing Backstage plugins and apps",
"version": "0.8.0",
"version": "0.8.1",
"private": false,
"publishConfig": {
"access": "public"
@@ -28,10 +28,10 @@
"backstage-cli": "bin/backstage-cli"
},
"dependencies": {
"@backstage/cli-common": "^0.1.4",
"@backstage/config": "^0.1.10",
"@backstage/config-loader": "^0.7.0",
"@backstage/errors": "^0.1.3",
"@backstage/cli-common": "^0.1.5",
"@backstage/config": "^0.1.11",
"@backstage/config-loader": "^0.7.1",
"@backstage/errors": "^0.1.4",
"@backstage/types": "^0.1.1",
"@hot-loader/react-dom": "^16.13.0",
"@lerna/package-graph": "^4.0.0",
@@ -117,14 +117,14 @@
"yn": "^4.0.0"
},
"devDependencies": {
"@backstage/backend-common": "^0.9.7",
"@backstage/config": "^0.1.10",
"@backstage/core-components": "^0.7.1",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/core-app-api": "^0.1.18",
"@backstage/backend-common": "^0.9.8",
"@backstage/config": "^0.1.11",
"@backstage/core-components": "^0.7.2",
"@backstage/core-plugin-api": "^0.1.12",
"@backstage/core-app-api": "^0.1.19",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@backstage/theme": "^0.2.11",
"@backstage/test-utils": "^0.1.20",
"@backstage/theme": "^0.2.12",
"@types/diff": "^5.0.0",
"@types/express": "^4.17.6",
"@types/fs-extra": "^9.0.1",
+6 -4
View File
@@ -24,14 +24,16 @@ import { tmpdir } from 'os';
import tar, { CreateOptions } from 'tar';
import { paths } from '../paths';
import { run } from '../run';
import { packageVersions } from '../version';
import { ParallelOption } from '../parallel';
import {
dependencies as cliDependencies,
devDependencies as cliDevDependencies,
} from '../../../package.json';
// These packages aren't safe to pack in parallel since the CLI depends on them
const UNSAFE_PACKAGES = [
...Object.keys(packageVersions),
'@backstage/cli-common',
'@backstage/config-loader',
...Object.keys(cliDependencies),
...Object.keys(cliDevDependencies),
];
type LernaPackage = {
+10
View File
@@ -1,5 +1,15 @@
# @backstage/codemods
## 0.1.20
### Patch Changes
- Updated dependencies
- @backstage/cli-common@0.1.5
- @backstage/core-components@0.7.2
- @backstage/core-app-api@0.1.19
- @backstage/core-plugin-api@0.1.12
## 0.1.19
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/codemods",
"description": "A collection of codemods for Backstage projects",
"version": "0.1.19",
"version": "0.1.20",
"private": false,
"publishConfig": {
"access": "public",
@@ -31,7 +31,7 @@
"backstage-codemods": "bin/backstage-codemods"
},
"dependencies": {
"@backstage/cli-common": "0.1.4",
"@backstage/cli-common": "0.1.5",
"@backstage/core-app-api": "*",
"@backstage/core-components": "*",
"@backstage/core-plugin-api": "*",
+11
View File
@@ -1,5 +1,16 @@
# @backstage/config-loader
## 0.7.1
### Patch Changes
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- ea21f7f567: bump `typescript-json-schema` from 0.50.1 to 0.51.0
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/cli-common@0.1.5
- @backstage/errors@0.1.4
## 0.7.0
### Minor Changes
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/config-loader",
"description": "Config loading functionality used by Backstage backend, and CLI",
"version": "0.7.0",
"version": "0.7.1",
"private": false,
"publishConfig": {
"access": "public",
@@ -30,9 +30,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/cli-common": "^0.1.4",
"@backstage/config": "^0.1.9",
"@backstage/errors": "^0.1.3",
"@backstage/cli-common": "^0.1.5",
"@backstage/config": "^0.1.11",
"@backstage/errors": "^0.1.4",
"@backstage/types": "^0.1.1",
"@types/json-schema": "^7.0.6",
"ajv": "^7.0.3",
+8
View File
@@ -1,5 +1,13 @@
# @backstage/config
## 0.1.11
### Patch Changes
- 10d267a1b7: Minor exports cleanup
- 41c49884d2: Start using the new `@backstage/types` package. Initially, this means using the `Observable` and `Json*` types from there. The types also remain in their old places but deprecated, and will be removed in a future release.
- 925a967f36: Replace usage of test-utils-core with test-utils
## 0.1.10
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/config",
"description": "Config API used by Backstage core, backend, and CLI",
"version": "0.1.10",
"version": "0.1.11",
"private": false,
"publishConfig": {
"access": "public",
@@ -34,7 +34,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@backstage/test-utils": "^0.1.19",
"@backstage/test-utils": "^0.1.20",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32"
},
+14
View File
@@ -1,5 +1,19 @@
# @backstage/core-app-api
## 0.1.19
### Patch Changes
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- 41c49884d2: Start using the new `@backstage/types` package. Initially, this means using the `Observable` and `Json*` types from there. The types also remain in their old places but deprecated, and will be removed in a future release.
- 925a967f36: Replace usage of test-utils-core with test-utils
- 6b615e92c8: Api cleanup, adding `@public` where necessary and tweaking some comments
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/theme@0.2.12
- @backstage/core-components@0.7.2
- @backstage/core-plugin-api@0.1.12
## 0.1.18
### Patch Changes
+7 -7
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-app-api",
"description": "Core app API used by Backstage 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-components": "^0.7.1",
"@backstage/config": "^0.1.10",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/theme": "^0.2.11",
"@backstage/core-components": "^0.7.2",
"@backstage/config": "^0.1.11",
"@backstage/core-plugin-api": "^0.1.12",
"@backstage/theme": "^0.2.12",
"@backstage/types": "^0.1.1",
"@backstage/version-bridge": "^0.1.0",
"@material-ui/core": "^4.12.2",
@@ -46,8 +46,8 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/test-utils": "^0.1.19",
"@backstage/cli": "^0.8.1",
"@backstage/test-utils": "^0.1.20",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/react-hooks": "^7.0.2",
+9
View File
@@ -18,6 +18,9 @@ import { IconComponent } from '@backstage/core-plugin-api';
import MuiApartmentIcon from '@material-ui/icons/Apartment';
import MuiBrokenImageIcon from '@material-ui/icons/BrokenImage';
import MuiCategoryIcon from '@material-ui/icons/Category';
import MuiCreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';
import MuiSubjectIcon from '@material-ui/icons/Subject';
import MuiSearchIcon from '@material-ui/icons/Search';
import MuiChatIcon from '@material-ui/icons/Chat';
import MuiDashboardIcon from '@material-ui/icons/Dashboard';
import MuiDocsIcon from '@material-ui/icons/Description';
@@ -35,6 +38,9 @@ import MuiWarningIcon from '@material-ui/icons/Warning';
type AppIconsKey =
| 'brokenImage'
| 'catalog'
| 'scaffolder'
| 'techdocs'
| 'search'
| 'chat'
| 'dashboard'
| 'docs'
@@ -58,6 +64,9 @@ export const defaultAppIcons: AppIcons = {
brokenImage: MuiBrokenImageIcon,
// To be confirmed: see https://github.com/backstage/backstage/issues/4970
catalog: MuiMenuBookIcon,
scaffolder: MuiCreateNewFolderIcon,
techdocs: MuiSubjectIcon,
search: MuiSearchIcon,
chat: MuiChatIcon,
dashboard: MuiDashboardIcon,
docs: MuiDocsIcon,
+12
View File
@@ -1,5 +1,17 @@
# @backstage/core-components
## 0.7.2
### Patch Changes
- afd5c82ce1: Updates the d3 dependencies
- c6c2942daa: Deprecated `DismissbleBannerClassKey` and fixed the typo to make `DismissableBannerClassKey`
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/theme@0.2.12
- @backstage/errors@0.1.4
- @backstage/core-plugin-api@0.1.12
## 0.7.1
### Patch Changes
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-components",
"description": "Core components used by Backstage plugins and apps",
"version": "0.7.1",
"version": "0.7.2",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,10 +29,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/config": "^0.1.10",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/errors": "^0.1.3",
"@backstage/theme": "^0.2.11",
"@backstage/config": "^0.1.11",
"@backstage/core-plugin-api": "^0.1.12",
"@backstage/errors": "^0.1.4",
"@backstage/theme": "^0.2.12",
"@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.18",
"@backstage/cli": "^0.8.0",
"@backstage/test-utils": "^0.1.19",
"@backstage/core-app-api": "^0.1.19",
"@backstage/cli": "^0.8.1",
"@backstage/test-utils": "^0.1.20",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/react-hooks": "^7.0.2",
@@ -105,3 +105,14 @@ export const Fixed = () => (
</ApiProvider>
</div>
);
export const Warning = () => (
<div style={containerStyle}>
<ApiProvider apis={apis}>
<DismissableBanner
message="This is a dismissable banner with a warning message"
variant="warning"
id="warning_dismissable"
/>
</ApiProvider>
</div>
);
@@ -79,12 +79,15 @@ const useStyles = makeStyles(
error: {
backgroundColor: theme.palette.banner.error,
},
warning: {
backgroundColor: theme.palette.banner.warning,
},
}),
{ name: 'BackstageDismissableBanner' },
);
type Props = {
variant: 'info' | 'error';
variant: 'info' | 'error' | 'warning';
message: ReactNode;
id: string;
fixed?: boolean;
@@ -15,13 +15,10 @@
*/
import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import {
wrapInTestApp,
Keyboard,
renderInTestApp,
} from '@backstage/test-utils';
import { fireEvent } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { HeaderActionMenu } from './HeaderActionMenu';
import userEvent from '@testing-library/user-event';
describe('<ComponentContextMenu />', () => {
it('renders without any items and without exploding', async () => {
@@ -89,16 +86,13 @@ describe('<ComponentContextMenu />', () => {
});
it('should close when hitting escape', async () => {
const rendered = render(
wrapInTestApp(
<HeaderActionMenu actionItems={[{ label: 'Some label' }]} />,
),
const rendered = await renderInTestApp(
<HeaderActionMenu actionItems={[{ label: 'Some label' }]} />,
);
expect(rendered.container.getAttribute('aria-hidden')).toBeNull();
fireEvent.click(rendered.getByTestId('header-action-menu'));
expect(rendered.container.getAttribute('aria-hidden')).toBe('true');
await Keyboard.type(rendered, '<Esc>');
userEvent.type(rendered.getByTestId('header-action-menu'), '{esc}');
expect(rendered.container.getAttribute('aria-hidden')).toBeNull();
});
});
+10
View File
@@ -1,5 +1,15 @@
# @backstage/core-plugin-api
## 0.1.12
### Patch Changes
- 41c49884d2: Start using the new `@backstage/types` package. Initially, this means using the `Observable` and `Json*` types from there. The types also remain in their old places but deprecated, and will be removed in a future release.
- 925a967f36: Replace usage of test-utils-core with test-utils
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/theme@0.2.12
## 0.1.11
### Patch Changes
+6 -6
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-plugin-api",
"description": "Core API used by Backstage plugins",
"version": "0.1.11",
"version": "0.1.12",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,8 +29,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/config": "^0.1.9",
"@backstage/theme": "^0.2.9",
"@backstage/config": "^0.1.11",
"@backstage/theme": "^0.2.12",
"@backstage/types": "^0.1.1",
"@backstage/version-bridge": "^0.1.0",
"@material-ui/core": "^4.12.2",
@@ -43,9 +43,9 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/core-app-api": "^0.1.18",
"@backstage/test-utils": "^0.1.19",
"@backstage/cli": "^0.8.1",
"@backstage/core-app-api": "^0.1.19",
"@backstage/test-utils": "^0.1.20",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/react-hooks": "^7.0.2",
+10
View File
@@ -1,5 +1,15 @@
# @backstage/create-app
## 0.4.2
## 0.4.1
### Patch Changes
- 4f1c30c176: Support optional path argument when generating a project using `create-app`
- Updated dependencies
- @backstage/cli-common@0.1.5
## 0.4.0
### Minor Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/create-app",
"description": "A CLI that helps you create your own Backstage app",
"version": "0.4.0",
"version": "0.4.2",
"private": false,
"publishConfig": {
"access": "public"
@@ -27,7 +27,7 @@
"start": "nodemon --"
},
"dependencies": {
"@backstage/cli-common": "^0.1.4",
"@backstage/cli-common": "^0.1.5",
"chalk": "^4.0.0",
"commander": "^6.1.0",
"fs-extra": "9.1.0",
+49 -24
View File
@@ -27,7 +27,7 @@ import { Task, templatingTask } from './lib/tasks';
const exec = promisify(execCb);
async function checkExists(rootDir: string, name: string) {
async function checkAppExists(rootDir: string, name: string) {
await Task.forItem('checking', name, async () => {
const destination = resolvePath(rootDir, name);
@@ -40,6 +40,17 @@ async function checkExists(rootDir: string, name: string) {
});
}
async function checkPathExists(path: string) {
await Task.forItem('checking', path, async () => {
try {
await fs.mkdirs(path);
} catch (error) {
// will fail if a file already exists at given `path`
throw new Error(`Failed to create app directory: ${error.message}`);
}
});
}
async function createTemporaryAppFolder(tempDir: string) {
await Task.forItem('creating', 'temporary directory', async () => {
try {
@@ -50,12 +61,6 @@ async function createTemporaryAppFolder(tempDir: string) {
});
}
async function cleanUp(tempDir: string) {
await Task.forItem('remove', 'temporary directory', async () => {
await fs.remove(tempDir);
});
}
async function buildApp(appDir: string) {
const runCmd = async (cmd: string) => {
await Task.forItem('executing', cmd, async () => {
@@ -75,11 +80,17 @@ async function buildApp(appDir: string) {
async function moveApp(tempDir: string, destination: string, id: string) {
await Task.forItem('moving', id, async () => {
await fs.move(tempDir, destination).catch(error => {
throw new Error(
`Failed to move app from ${tempDir} to ${destination}: ${error.message}`,
);
});
await fs
.move(tempDir, destination)
.catch(error => {
throw new Error(
`Failed to move app from ${tempDir} to ${destination}: ${error.message}`,
);
})
.finally(() => {
// remove temporary files on both success and failure
fs.removeSync(tempDir);
});
});
}
@@ -117,23 +128,40 @@ export default async (cmd: Command): Promise<void> => {
const templateDir = paths.resolveOwn('templates/default-app');
const tempDir = resolvePath(os.tmpdir(), answers.name);
const appDir = resolvePath(paths.targetDir, answers.name);
// Use `--path` argument as applicaiton directory when specified, otherwise
// create a directory using `answers.name`
const appDir = cmd.path
? resolvePath(paths.targetDir, cmd.path)
: resolvePath(paths.targetDir, answers.name);
Task.log();
Task.log('Creating the app...');
try {
Task.section('Checking if the directory is available');
await checkExists(paths.targetDir, answers.name);
if (cmd.path) {
// Template directly to specified path
Task.section('Creating a temporary app directory');
await createTemporaryAppFolder(tempDir);
Task.section('Checking that supplied path exists');
await checkPathExists(appDir);
Task.section('Preparing files');
await templatingTask(templateDir, tempDir, answers);
Task.section('Preparing files');
await templatingTask(templateDir, cmd.path, answers);
} else {
// Template to temporary location, and then move files
Task.section('Moving to final location');
await moveApp(tempDir, appDir, answers.name);
Task.section('Checking if the directory is available');
await checkAppExists(paths.targetDir, answers.name);
Task.section('Creating a temporary app directory');
await createTemporaryAppFolder(tempDir);
Task.section('Preparing files');
await templatingTask(templateDir, tempDir, answers);
Task.section('Moving to final location');
await moveApp(tempDir, appDir, answers.name);
}
if (!cmd.skipInstall) {
Task.section('Building the app');
@@ -157,10 +185,7 @@ export default async (cmd: Command): Promise<void> => {
Task.error(String(error));
Task.log('It seems that something went wrong when creating the app 🤔');
Task.log('We are going to clean up, and then you can try again.');
Task.section('Cleanup');
await cleanUp(tempDir);
Task.error('🔥 Failed to create app!');
Task.exit(1);
}
+7 -3
View File
@@ -26,10 +26,14 @@ import { version } from '../package.json';
import createApp from './createApp';
const main = (argv: string[]) => {
program.name('backstage-create-app').version(version);
program
.description('Creates a new app in a new directory')
.name('backstage-create-app')
.version(version)
.description('Creates a new app in a new directory or specified path')
.option(
'--path [directory]',
'Location to store the app defaulting to a new folder with the app name',
)
.option(
'--skip-install',
'Skip the install and builds steps after creating the app',
+3 -2
View File
@@ -28,15 +28,16 @@
"@backstage/errors": "^0.1.2",
"@types/fs-extra": "^9.0.1",
"@types/node": "^14.14.32",
"@types/puppeteer": "^5.4.4",
"chalk": "^4.0.0",
"commander": "^6.1.0",
"cross-fetch": "^3.0.6",
"fs-extra": "9.1.0",
"handlebars": "^4.7.3",
"pgtools": "^0.3.0",
"puppeteer": "^10.4.0",
"tree-kill": "^1.2.2",
"ts-node": "^10.0.0",
"zombie": "^6.1.4"
"ts-node": "^10.0.0"
},
"nodemonConfig": {
"watch": "./src",
+37 -10
View File
@@ -20,7 +20,8 @@ import fetch from 'cross-fetch';
import handlebars from 'handlebars';
import killTree from 'tree-kill';
import { resolve as resolvePath, join as joinPath } from 'path';
import Browser from 'zombie';
import puppeteer from 'puppeteer';
import {
spawnPiped,
runPlain,
@@ -350,17 +351,21 @@ async function testAppServe(pluginName: string, appDir: string) {
GITHUB_TOKEN: 'abc',
},
});
Browser.localhost('localhost', 3000);
let successful = false;
let browser;
try {
for (let attempts = 1; ; attempts++) {
try {
const browser = new Browser();
browser = await puppeteer.launch();
const page = await browser.newPage();
await waitForPageWithText(browser, '/', 'My Company Catalog');
await page.goto('http://localhost:3000', { waitUntil: 'networkidle0' });
await waitForPageWithText(page, '/', 'My Company Catalog');
await waitForPageWithText(
browser,
page,
`/${pluginName}`,
`Welcome to ${pluginName}!`,
);
@@ -372,13 +377,15 @@ async function testAppServe(pluginName: string, appDir: string) {
if (attempts >= 20) {
throw new Error(`App serve test failed, ${error}`);
}
console.log(`App serve failed, trying again, ${error}`);
print(`App serve failed, trying again, ${error}`);
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
} finally {
// Kill entire process group, otherwise we'll end up with hanging serve processes
killTree(startApp.pid);
await new Promise<void>((res, rej) =>
killTree(startApp.pid, err => (err ? rej(err) : res())),
);
}
try {
@@ -438,9 +445,26 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
});
let successful = false;
const stdErrorHasErrors = (input: string) => {
const lines = input.split('\n').filter(Boolean);
return (
lines.filter(
l =>
!l.includes('Use of deprecated folder mapping') &&
!l.includes('Update this package.json to use a subpath') &&
!l.includes(
'(Use `node --trace-deprecation ...` to show where the warning was created)',
),
).length !== 0
);
};
try {
await waitFor(() => stdout.includes('Listening on ') || stderr !== '');
if (stderr !== '') {
await waitFor(
() => stdout.includes('Listening on ') || stdErrorHasErrors(stderr),
);
if (stdErrorHasErrors(stderr)) {
print(`Expected stderr to be clean, got ${stderr}`);
// Skipping the whole block
throw new Error(stderr);
}
@@ -453,11 +477,14 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
print('Entities fetched successfully');
successful = true;
} catch (error) {
print('');
throw new Error(`Backend failed to startup: ${error}`);
} finally {
print('Stopping the child process');
// Kill entire process group, otherwise we'll end up with hanging serve processes
killTree(child.pid);
await new Promise<void>((res, rej) =>
killTree(child.pid, err => (err ? rej(err) : res())),
);
}
try {
+17 -9
View File
@@ -22,6 +22,7 @@ import {
ChildProcess,
} from 'child_process';
import { promisify } from 'util';
import puppeteer from 'puppeteer';
const execFile = promisify(execFileCb);
@@ -125,7 +126,7 @@ export async function waitForExit(child: ChildProcess) {
}
export async function waitForPageWithText(
browser: any,
page: puppeteer.Page,
path: string,
text: string,
{ intervalMs = 1000, maxFindAttempts = 50 } = {},
@@ -137,18 +138,25 @@ export async function waitForPageWithText(
console.log(`Attempting to load page at ${path}, waiting ${waitTimeMs}`);
await new Promise(resolve => setTimeout(resolve, waitTimeMs));
await browser.visit(path);
await page.goto(`http://localhost:3000${path}`, {
waitUntil: 'networkidle0',
});
await new Promise(resolve => setTimeout(resolve, waitTimeMs));
const escapedText = text.replace(/"|\\/g, '\\$&');
browser.assert.evaluate(
`Array.from(document.querySelectorAll("*")).some(el => el.textContent === "${escapedText}")`,
true,
`expected to find text ${text}`,
const match = await page.evaluate(
textContent =>
Array.from(document.querySelectorAll('*')).some(
el => el.textContent === textContent,
),
text,
);
if (!match) {
throw new Error(`Expected to find text ${text}`);
}
break;
} catch (error) {
console.log(error);
assertError(error);
findAttempts++;
+8
View File
@@ -1,5 +1,13 @@
# @backstage/errors
## 0.1.4
### Patch Changes
- a15d028517: More API fixes: mark things public, add docs, fix exports
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- 8c30ae8902: Add `stringifyError` that is useful for logging e.g. `Something went wrong, ${stringifyError(e)}`
## 0.1.3
### Patch Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/errors",
"description": "Common utilities for error handling within Backstage",
"version": "0.1.3",
"version": "0.1.4",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -35,7 +35,7 @@
"serialize-error": "^8.0.1"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/cli": "^0.8.1",
"@types/jest": "^26.0.7"
},
"files": [
+12
View File
@@ -1,5 +1,17 @@
# @backstage/integration-react
## 0.1.13
### Patch Changes
- 36e2b548cb: Clean up the API exports
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/theme@0.2.12
- @backstage/integration@0.6.9
- @backstage/core-components@0.7.2
- @backstage/core-plugin-api@0.1.12
## 0.1.12
### Patch Changes
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/integration-react",
"description": "Frontend package for managing integrations towards external systems",
"version": "0.1.12",
"version": "0.1.13",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,11 +21,11 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/config": "^0.1.10",
"@backstage/core-components": "^0.7.1",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/integration": "^0.6.8",
"@backstage/theme": "^0.2.11",
"@backstage/config": "^0.1.11",
"@backstage/core-components": "^0.7.2",
"@backstage/core-plugin-api": "^0.1.12",
"@backstage/integration": "^0.6.9",
"@backstage/theme": "^0.2.12",
"@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.8.0",
"@backstage/cli": "^0.8.1",
"@backstage/dev-utils": "^0.2.12",
"@backstage/test-utils": "^0.1.19",
"@backstage/test-utils": "^0.1.20",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
+8
View File
@@ -1,5 +1,13 @@
# @backstage/integration
## 0.6.9
### Patch Changes
- a15d028517: More API fixes: mark things public, add docs, fix exports
- Updated dependencies
- @backstage/config@0.1.11
## 0.6.8
### Patch Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/integration",
"description": "Helpers for managing integrations towards external systems",
"version": "0.6.8",
"version": "0.6.9",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,7 +30,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/config": "^0.1.10",
"@backstage/config": "^0.1.11",
"cross-fetch": "^3.0.6",
"git-url-parse": "^11.6.0",
"@octokit/rest": "^18.5.3",
@@ -39,9 +39,9 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/config-loader": "^0.7.0",
"@backstage/test-utils": "^0.1.19",
"@backstage/cli": "^0.8.1",
"@backstage/config-loader": "^0.7.1",
"@backstage/test-utils": "^0.1.20",
"@types/jest": "^26.0.7",
"@types/luxon": "^2.0.4",
"msw": "^0.35.0"
+6
View File
@@ -1,5 +1,11 @@
# @backstage/search-common
## 0.2.1
### Patch Changes
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
## 0.2.0
### Minor Changes
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/search-common",
"description": "Common functionalities for Search, to be shared between various search-enabled plugins",
"version": "0.2.0",
"version": "0.2.1",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -39,7 +39,7 @@
"@backstage/types": "^0.1.1"
},
"devDependencies": {
"@backstage/cli": "^0.8.0"
"@backstage/cli": "^0.8.1"
},
"jest": {
"roots": [
+13
View File
@@ -1,5 +1,18 @@
# @backstage/techdocs-common
## 0.10.5
### Patch Changes
- d207f6ee9e: Support optional bucketRootPath configuration parameter in S3 and GCS publishers
- Updated dependencies
- @backstage/config@0.1.11
- @backstage/errors@0.1.4
- @backstage/integration@0.6.9
- @backstage/backend-common@0.9.8
- @backstage/catalog-model@0.9.6
- @backstage/search-common@0.2.1
## 0.10.4
### Patch Changes
+1 -1
View File
@@ -256,7 +256,7 @@ export class TechdocsGenerator implements GeneratorBase {
config: Config;
scmIntegrations: ScmIntegrationRegistry;
});
static readonly defaultDockerImage = 'spotify/techdocs:v0.3.4';
static readonly defaultDockerImage = 'spotify/techdocs:v0.3.5';
// (undocumented)
static fromConfig(
config: Config,
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/techdocs-common",
"description": "Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli",
"version": "0.10.4",
"version": "0.10.5",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -38,12 +38,12 @@
"dependencies": {
"@azure/identity": "^1.5.0",
"@azure/storage-blob": "^12.5.0",
"@backstage/backend-common": "^0.9.7",
"@backstage/catalog-model": "^0.9.5",
"@backstage/config": "^0.1.8",
"@backstage/errors": "^0.1.3",
"@backstage/search-common": "^0.2.0",
"@backstage/integration": "^0.6.7",
"@backstage/backend-common": "^0.9.8",
"@backstage/catalog-model": "^0.9.6",
"@backstage/config": "^0.1.11",
"@backstage/errors": "^0.1.4",
"@backstage/search-common": "^0.2.1",
"@backstage/integration": "^0.6.9",
"@google-cloud/storage": "^5.6.0",
"@trendyol-js/openstack-swift-sdk": "^0.0.4",
"@types/express": "^4.17.6",
@@ -60,7 +60,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/cli": "^0.8.1",
"@types/fs-extra": "^9.0.5",
"@types/js-yaml": "^4.0.0",
"@types/mime-types": "^2.1.0",
@@ -44,7 +44,7 @@ export class TechdocsGenerator implements GeneratorBase {
* The default docker image (and version) used to generate content. Public
* and static so that techdocs-common consumers can use the same version.
*/
public static readonly defaultDockerImage = 'spotify/techdocs:v0.3.4';
public static readonly defaultDockerImage = 'spotify/techdocs:v0.3.5';
private readonly logger: Logger;
private readonly containerRunner: ContainerRunner;
private readonly options: GeneratorConfig;
+9
View File
@@ -1,5 +1,14 @@
# @backstage/test-utils-core
## 0.1.4
### Patch Changes
- bb12aae352: Migrates all utility methods from `test-utils-core` into `test-utils` and delete exports from the old package.
This should have no impact since this package is considered internal and have no usages outside core packages.
Notable changes are that the testing tool `msw.setupDefaultHandlers()` have been deprecated in favour of `setupRequestMockHandlers()`.
## 0.1.3
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/test-utils-core",
"description": "Utilities to test Backstage core",
"version": "0.1.3",
"version": "0.1.4",
"private": false,
"publishConfig": {
"access": "public",
+16
View File
@@ -1,5 +1,21 @@
# @backstage/test-utils
## 0.1.20
### Patch Changes
- bb12aae352: Migrates all utility methods from `test-utils-core` into `test-utils` and delete exports from the old package.
This should have no impact since this package is considered internal and have no usages outside core packages.
Notable changes are that the testing tool `msw.setupDefaultHandlers()` have been deprecated in favour of `setupRequestMockHandlers()`.
- c5bb1df55d: Bump `msw` to `v0.35.0` to resolve [CVE-2021-32796](https://github.com/advisories/GHSA-5fg8-2547-mr8q).
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
- Updated dependencies
- @backstage/theme@0.2.12
- @backstage/core-app-api@0.1.19
- @backstage/core-plugin-api@0.1.12
## 0.1.19
### Patch Changes
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/test-utils",
"description": "Utilities to test Backstage plugins and apps.",
"version": "0.1.19",
"version": "0.1.20",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,9 +29,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/core-app-api": "^0.1.18",
"@backstage/core-plugin-api": "^0.1.11",
"@backstage/theme": "^0.2.11",
"@backstage/core-app-api": "^0.1.19",
"@backstage/core-plugin-api": "^0.1.12",
"@backstage/theme": "^0.2.12",
"@backstage/types": "^0.1.1",
"@material-ui/core": "^4.12.2",
"@testing-library/jest-dom": "^5.10.1",
@@ -45,7 +45,7 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
"@backstage/cli": "^0.8.0",
"@backstage/cli": "^0.8.1",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32"
},
@@ -25,7 +25,7 @@ const codes = {
/**
* @public
* @deprecated because it has no usages. Perhaps resurfaced in the future when need be.
* @deprecated superseded by {@link @testing-library/user-event#userEvent}
*/
export class Keyboard {
static async type(target, input) {

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