diff --git a/.changeset/afraid-garlics-glow.md b/.changeset/afraid-garlics-glow.md
new file mode 100644
index 0000000000..dfe2596869
--- /dev/null
+++ b/.changeset/afraid-garlics-glow.md
@@ -0,0 +1,5 @@
+---
+'@backstage/cli': patch
+---
+
+The `create-plugin` and `create` commands have both been deprecated in favor of a new `new` command. The `new` command is functionally identical to `create`, but the new naming makes it possible to use as yarn script, since `yarn create` is reserved.
diff --git a/.changeset/cool-cameras-count.md b/.changeset/cool-cameras-count.md
new file mode 100644
index 0000000000..02c8ffc2bd
--- /dev/null
+++ b/.changeset/cool-cameras-count.md
@@ -0,0 +1,5 @@
+---
+'@backstage/core-app-api': patch
+---
+
+When using React Router v6 stable, it is now possible for components within the `Route` element tree to have `path` props, although they will be ignored.
diff --git a/.changeset/famous-pianos-kick.md b/.changeset/famous-pianos-kick.md
new file mode 100644
index 0000000000..51688077f9
--- /dev/null
+++ b/.changeset/famous-pianos-kick.md
@@ -0,0 +1,5 @@
+---
+'@backstage/cli': patch
+---
+
+The `versions:bump` command will now update dependency ranges in `package.json`, even if the new version is within the current range.
diff --git a/.changeset/fast-paws-press.md b/.changeset/fast-paws-press.md
new file mode 100644
index 0000000000..8ddb0bc49e
--- /dev/null
+++ b/.changeset/fast-paws-press.md
@@ -0,0 +1,5 @@
+---
+'@backstage/cli': patch
+---
+
+Added support for custom certificate for webpack dev server.
diff --git a/.changeset/search-feet-flash.md b/.changeset/search-feet-flash.md
new file mode 100644
index 0000000000..c7423f0317
--- /dev/null
+++ b/.changeset/search-feet-flash.md
@@ -0,0 +1,59 @@
+---
+'@backstage/plugin-search-react': minor
+---
+
+Provides search autocomplete functionality through a `SearchAutocomplete` component.
+A `SearchAutocompleteDefaultOption` can also be used to render options with icons, primary texts, and secondary texts.
+Example:
+
+```jsx
+import React, { ChangeEvent, useState, useCallback } from 'react';
+import useAsync from 'react-use/lib/useAsync';
+
+import { Grid, Paper } from '@material-ui/core';
+
+import { Page, Content } from '@backstage/core-components';
+import { SearchAutocomplete, SearchAutocompleteDefaultOption} from '@backstage/plugin-search-react';
+
+const OptionsIcon = () =>
+
+const SearchPage = () => {
+ const [inputValue, setInputValue] = useState('');
+
+ const options = useAsync(async () => {
+ // Gets and returns autocomplete options
+ }, [inputValue])
+
+ const useCallback((_event: ChangeEvent<{}>, newInputValue: string) => {
+ setInputValue(newInputValue);
+ }, [setInputValue])
+
+ return (
+
+
+
+
+
+ option.title}
+ renderOption={option => (
+ }
+ primaryText={option.title}
+ secondaryText={option.text}
+ />
+ )}
+ />
+
+
+
+ {'/* Filters and results are omitted */'}
+
+
+ );
+};
+```
diff --git a/.changeset/search-planets-flash.md b/.changeset/search-planets-flash.md
new file mode 100644
index 0000000000..49431128f9
--- /dev/null
+++ b/.changeset/search-planets-flash.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-search': patch
+---
+
+Use the new `inheritParentContextIfAvailable` search context property in `SearchModal` instead of manually checking if a parent context exists, this conditional statement was previously duplicated in more than one component like in `SearchBar` as well and is now only done in ` SearchContextProvider`.
diff --git a/.changeset/search-zebras-tap.md b/.changeset/search-zebras-tap.md
new file mode 100644
index 0000000000..4593478a51
--- /dev/null
+++ b/.changeset/search-zebras-tap.md
@@ -0,0 +1,7 @@
+---
+'@backstage/plugin-search-react': minor
+---
+
+We noticed a repeated check for the existence of a parent context before creating a child search context in more the one component such as Search Modal and Search Bar and to remove code duplication we extract the conditional to the context provider, now you can use it passing an `inheritParentContextIfAvailable` prop to the `SearchContextProvider`.
+
+Note: This added property does not create a local context if there is a parent context and in this case, you cannot use it together with `initialState`, it will result in a type error because the parent context is already initialized.
diff --git a/.changeset/selfish-wasps-cough.md b/.changeset/selfish-wasps-cough.md
new file mode 100644
index 0000000000..cc00520385
--- /dev/null
+++ b/.changeset/selfish-wasps-cough.md
@@ -0,0 +1,14 @@
+---
+'@backstage/create-app': patch
+---
+
+Added `yarn new` as one of the scripts installed by default, which calls `backstage-cli new`. This script replaces `create-plugin`, which you can now remove if you want to. It is kept in the `create-app` template for backwards compatibility.
+
+The `remove-plugin` command has been removed, as it has been removed from the Backstage CLI.
+
+To apply these changes to an existing app, make the following change to the root `package.json`:
+
+```diff
+- "remove-plugin": "backstage-cli remove-plugin"
++ "new": "backstage-cli new --scope internal"
+```
diff --git a/.changeset/smart-squids-change.md b/.changeset/smart-squids-change.md
new file mode 100644
index 0000000000..51396114c9
--- /dev/null
+++ b/.changeset/smart-squids-change.md
@@ -0,0 +1,5 @@
+---
+'@backstage/cli': patch
+---
+
+Added a new `backstage-cli repo clean` command that cleans the repo root and runs the clean script in all packages.
diff --git a/.changeset/techdocs-feet-dress.md b/.changeset/techdocs-feet-dress.md
new file mode 100644
index 0000000000..d2b2a625af
--- /dev/null
+++ b/.changeset/techdocs-feet-dress.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-techdocs': patch
+---
+
+Use the new `SearchAutocomplete` component in the `TechDocsSearch` component to maintain consistency across search experiences and avoid code duplication.
diff --git a/.changeset/weak-camels-roll.md b/.changeset/weak-camels-roll.md
new file mode 100644
index 0000000000..90636605ec
--- /dev/null
+++ b/.changeset/weak-camels-roll.md
@@ -0,0 +1,12 @@
+---
+'@backstage/create-app': patch
+---
+
+Updated the root `package.json` to use the new `backstage-cli repo clean` command.
+
+To apply this change to an existing project, make the following change to the root `package.json`:
+
+```diff
+- "clean": "backstage-cli clean && lerna run clean",
++ "clean": "backstage-cli repo clean",
+```
diff --git a/app-config.yaml b/app-config.yaml
index 32b53da236..7c93d9cbd2 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -7,7 +7,6 @@ app:
# applicationId: qwerty
# site: # datadoghq.eu default = datadoghq.com
# env: # optional
-
support:
url: https://github.com/backstage/backstage/issues # Used by common ErrorPage
items: # Used by common SupportButton component
diff --git a/docs/plugins/backend-plugin.md b/docs/plugins/backend-plugin.md
index d34bc1710f..c6f4a50e60 100644
--- a/docs/plugins/backend-plugin.md
+++ b/docs/plugins/backend-plugin.md
@@ -154,3 +154,39 @@ 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..
+
+## Making Use of the User's Identity
+
+The Backstage backend comes with a facility for retrieving the identity of the
+logged in user.
+
+As part of the environment object that is passed to your `createPlugin`
+function, there is a `identity` field. You can use that to get an identity
+from the request.
+
+```ts
+// in packages/backend/src/plugins/carmen.ts
+export default async function createPlugin(
+ env: PluginEnvironment,
+): Promise {
+ return await createRouter({
+ model: model,
+ logger: env.logger,
+ identity: env.identity,
+ });
+}
+```
+
+The plugin can then extract the identity from the request.
+
+```ts
+export async function createRouter(
+ options: RouterOptions,
+): Promise {
+ const router = Router();
+
+ router.post('/example', async (req, res) => {
+ const identity = await identity.getIdentity({ request: req });
+ ...
+ });
+```
diff --git a/package.json b/package.json
index 7db239905c..77ee1dccc5 100644
--- a/package.json
+++ b/package.json
@@ -13,8 +13,8 @@
"build:api-reports:only": "ts-node -T -P scripts/tsconfig.json scripts/api-extractor.ts",
"build:api-docs": "yarn build:api-reports --docs",
"tsc": "tsc",
- "tsc:full": "backstage-cli clean && tsc --skipLibCheck false --incremental false",
- "clean": "backstage-cli clean && lerna run clean",
+ "tsc:full": "backstage-cli repo clean && tsc --skipLibCheck false --incremental false",
+ "clean": "backstage-cli repo clean",
"diff": "lerna run diff --",
"test": "backstage-cli test",
"test:all": "lerna run test -- --coverage",
@@ -23,9 +23,8 @@
"lint:all": "backstage-cli repo lint",
"lint:type-deps": "node scripts/check-type-dependencies.js",
"docker-build": "yarn tsc && yarn workspace example-backend build --build-dependencies && yarn workspace example-backend build-image",
- "backstage-create": "backstage-cli create --scope backstage --no-private",
- "create-plugin": "yarn backstage-create --select plugin",
- "remove-plugin": "backstage-cli remove-plugin",
+ "new": "backstage-cli new --scope backstage --no-private",
+ "create-plugin": "echo \"use 'yarn new' instead\"",
"release": "node scripts/prepare-release.js && changeset version && yarn diff --yes && yarn prettier --write '{packages,plugins}/*/{package.json,CHANGELOG.md}' '.changeset/*.json' && yarn install --no-immutable",
"prettier:check": "prettier --check .",
"lerna": "lerna",
diff --git a/packages/cli/cli-report.md b/packages/cli/cli-report.md
index dabab76850..1c86c8723c 100644
--- a/packages/cli/cli-report.md
+++ b/packages/cli/cli-report.md
@@ -12,8 +12,7 @@ Options:
-h, --help
Commands:
- create [options]
- create-plugin [options]
+ new [options]
plugin:diff [options]
test
config:docs [options]
@@ -100,20 +99,6 @@ Options:
-h, --help
```
-### `backstage-cli create`
-
-```
-Usage: backstage-cli create [options]
-
-Options:
- --select
- --option =
- --scope
- --npm-registry
- --no-private
- -h, --help
-```
-
### `backstage-cli create-github-app`
```
@@ -123,19 +108,6 @@ Options:
-h, --help
```
-### `backstage-cli create-plugin`
-
-```
-Usage: backstage-cli create-plugin [options]
-
-Options:
- --backend
- --scope
- --npm-registry
- --no-private
- -h, --help
-```
-
### `backstage-cli info`
```
@@ -197,6 +169,20 @@ Options:
-h, --help
```
+### `backstage-cli new`
+
+```
+Usage: backstage-cli new [options]
+
+Options:
+ --select
+ --option =
+ --scope
+ --npm-registry
+ --no-private
+ -h, --help
+```
+
### `backstage-cli package`
```
@@ -415,6 +401,7 @@ Options:
Commands:
build [options]
lint [options]
+ clean
help [command]
```
@@ -429,6 +416,15 @@ Options:
-h, --help
```
+### `backstage-cli repo clean`
+
+```
+Usage: backstage-cli repo clean [options]
+
+Options:
+ -h, --help
+```
+
### `backstage-cli repo lint`
```
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 14482fc95b..5514b881e1 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -248,6 +248,32 @@
"description": "The port that the frontend should be bound to. Only used for local development."
}
}
+ },
+ "https": {
+ "type": "object",
+ "description": "Only used for local development. The https object is passed to webpack in order to enable using https on localhost.",
+ "properties": {
+ "certificate": {
+ "type": "object",
+ "description": "Parent object containing certificate and the private key",
+ "required": [
+ "key",
+ "cert"
+ ],
+ "properties": {
+ "key": {
+ "type": "string",
+ "visibility": "secret",
+ "description": "Https Certificate private key. Use $file to load in a file"
+ },
+ "cert": {
+ "type": "string",
+ "visibility": "secret",
+ "description": "Https Certificate. Use $file to load in a file"
+ }
+ }
+ }
+ }
}
}
}
diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts
index def16900fa..0af1674b6c 100644
--- a/packages/cli/src/commands/index.ts
+++ b/packages/cli/src/commands/index.ts
@@ -60,6 +60,11 @@ export function registerRepoCommand(program: Command) {
.option('--fix', 'Attempt to automatically fix violations')
.action(lazy(() => import('./repo/lint').then(m => m.command)));
+ command
+ .command('clean')
+ .description('Delete cache and output directories')
+ .action(lazy(() => import('./repo/clean').then(m => m.command)));
+
command
.command('list-deprecations', { hidden: true })
.description('List deprecations. [EXPERIMENTAL]')
@@ -193,7 +198,7 @@ export function registerMigrateCommand(program: Command) {
export function registerCommands(program: Command) {
program
- .command('create')
+ .command('new')
.storeOptionsAsProperties(false)
.description(
'Open up an interactive guide to creating new things in your app',
@@ -214,15 +219,39 @@ export function registerCommands(program: Command) {
'The package registry to use for new packages',
)
.option('--no-private', 'Do not mark new packages as private')
- .action(lazy(() => import('./create/create').then(m => m.default)));
+ .action(lazy(() => import('./new/new').then(m => m.default)));
program
- .command('create-plugin')
+ .command('create', { hidden: true })
+ .storeOptionsAsProperties(false)
+ .description(
+ 'Open up an interactive guide to creating new things in your app [DEPRECATED]',
+ )
+ .option(
+ '--select ',
+ 'Select the thing you want to be creating upfront',
+ )
+ .option(
+ '--option =',
+ 'Pre-fill options for the creation process',
+ (opt, arr: string[]) => [...arr, opt],
+ [],
+ )
+ .option('--scope ', 'The scope to use for new packages')
+ .option(
+ '--npm-registry ',
+ 'The package registry to use for new packages',
+ )
+ .option('--no-private', 'Do not mark new packages as private')
+ .action(lazy(() => import('./new/new').then(m => m.default)));
+
+ program
+ .command('create-plugin', { hidden: true })
.option(
'--backend',
'Create plugin with the backend dependencies as default',
)
- .description('Creates a new plugin in the current repository')
+ .description('Creates a new plugin in the current repository [DEPRECATED]')
.option('--scope ', 'npm scope')
.option('--npm-registry ', 'npm registry URL')
.option('--no-private', 'Public npm package')
diff --git a/packages/cli/src/commands/create/create.ts b/packages/cli/src/commands/new/new.ts
similarity index 98%
rename from packages/cli/src/commands/create/create.ts
rename to packages/cli/src/commands/new/new.ts
index c784307738..b0d30c0415 100644
--- a/packages/cli/src/commands/create/create.ts
+++ b/packages/cli/src/commands/new/new.ts
@@ -18,7 +18,7 @@ import os from 'os';
import fs from 'fs-extra';
import { join as joinPath } from 'path';
import { OptionValues } from 'commander';
-import { FactoryRegistry } from '../../lib/create/FactoryRegistry';
+import { FactoryRegistry } from '../../lib/new/FactoryRegistry';
import { paths } from '../../lib/paths';
import { assertError } from '@backstage/errors';
import { Task } from '../../lib/tasks';
diff --git a/packages/cli/src/commands/repo/clean.ts b/packages/cli/src/commands/repo/clean.ts
new file mode 100644
index 0000000000..323746e089
--- /dev/null
+++ b/packages/cli/src/commands/repo/clean.ts
@@ -0,0 +1,57 @@
+/*
+ * 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 { execFile as execFileCb } from 'child_process';
+import fs from 'fs-extra';
+import { resolve as resolvePath } from 'path';
+import { promisify } from 'util';
+import { PackageGraph } from '../../lib/monorepo';
+import { paths } from '../../lib/paths';
+
+const execFile = promisify(execFileCb);
+
+export async function command(): Promise {
+ const packages = await PackageGraph.listTargetPackages();
+
+ await fs.remove(paths.resolveTargetRoot('dist'));
+ await fs.remove(paths.resolveTargetRoot('dist-types'));
+ await fs.remove(paths.resolveTargetRoot('coverage'));
+
+ await Promise.all(
+ Array.from(Array(10), async () => {
+ while (packages.length > 0) {
+ const pkg = packages.pop()!;
+ const cleanScript = pkg.packageJson.scripts?.clean;
+
+ if (
+ cleanScript === 'backstage-cli clean' ||
+ cleanScript === 'backstage-cli package clean'
+ ) {
+ await fs.remove(resolvePath(pkg.dir, 'dist'));
+ await fs.remove(resolvePath(pkg.dir, 'dist-types'));
+ await fs.remove(resolvePath(pkg.dir, 'coverage'));
+ } else if (cleanScript) {
+ const result = await execFile('yarn', ['run', 'clean'], {
+ cwd: pkg.dir,
+ shell: true,
+ });
+ process.stdout.write(result.stdout);
+ process.stderr.write(result.stderr);
+ }
+ }
+ }),
+ );
+}
diff --git a/packages/cli/src/commands/versions/bump.test.ts b/packages/cli/src/commands/versions/bump.test.ts
index cdbf6779a4..a127d15953 100644
--- a/packages/cli/src/commands/versions/bump.test.ts
+++ b/packages/cli/src/commands/versions/bump.test.ts
@@ -174,6 +174,8 @@ describe('bump', () => {
'unlocking @backstage/core@^1.0.3 ~> 1.0.6',
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
+ 'bumping @backstage/core in a to ^1.0.6',
+ 'bumping @backstage/core in b to ^1.0.6',
'bumping @backstage/theme in b to ^2.0.0',
'Running yarn install to install new versions',
'⚠️ The following packages may have breaking changes:',
@@ -210,15 +212,15 @@ describe('bump', () => {
expect(packageA).toEqual({
name: 'a',
dependencies: {
- '@backstage/core': '^1.0.5', // not bumped since new version is within range
+ '@backstage/core': '^1.0.6',
},
});
const packageB = await fs.readJson('/packages/b/package.json');
expect(packageB).toEqual({
name: 'b',
dependencies: {
- '@backstage/core': '^1.0.3', // not bumped
- '@backstage/theme': '^2.0.0', // bumped since newer
+ '@backstage/core': '^1.0.6',
+ '@backstage/theme': '^2.0.0',
},
});
});
@@ -297,6 +299,8 @@ describe('bump', () => {
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
'bumping @backstage/theme in b to ^5.0.0',
+ 'bumping @backstage/core in b to ^1.0.6',
+ 'bumping @backstage/core in a to ^1.0.6',
'Your project is now at version 0.0.1, which has been written to backstage.json',
'Running yarn install to install new versions',
'⚠️ The following packages may have breaking changes:',
@@ -333,15 +337,15 @@ describe('bump', () => {
expect(packageA).toEqual({
name: 'a',
dependencies: {
- '@backstage/core': '^1.0.5', // not bumped since new version is within range
+ '@backstage/core': '^1.0.6',
},
});
const packageB = await fs.readJson('/packages/b/package.json');
expect(packageB).toEqual({
name: 'b',
dependencies: {
- '@backstage/core': '^1.0.3', // not bumped
- '@backstage/theme': '^5.0.0', // bumped since newer
+ '@backstage/core': '^1.0.6',
+ '@backstage/theme': '^5.0.0',
},
});
});
@@ -544,6 +548,8 @@ describe('bump', () => {
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
'bumping @backstage/theme in b to ^5.0.0',
+ 'bumping @backstage/core in b to ^1.0.6',
+ 'bumping @backstage/core in a to ^1.0.6',
'Your project is now at version 1.0.0, which has been written to backstage.json',
'Running yarn install to install new versions',
'⚠️ The following packages may have breaking changes:',
@@ -650,7 +656,11 @@ describe('bump', () => {
'unlocking @backstage-extra/custom@^1.0.1 ~> 1.1.0',
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
+ 'bumping @backstage/core in a to ^1.0.6',
+ 'bumping @backstage-extra/custom in a to ^1.1.0',
'bumping @backstage-extra/custom-two in a to ^2.0.0',
+ 'bumping @backstage/core in b to ^1.0.6',
+ 'bumping @backstage-extra/custom in b to ^1.1.0',
'bumping @backstage-extra/custom-two in b to ^2.0.0',
'bumping @backstage/theme in b to ^2.0.0',
'Skipping backstage.json update as custom pattern is used',
@@ -690,9 +700,9 @@ describe('bump', () => {
expect(packageA).toEqual({
name: 'a',
dependencies: {
- '@backstage-extra/custom': '^1.0.1',
+ '@backstage-extra/custom': '^1.1.0',
'@backstage-extra/custom-two': '^2.0.0',
- '@backstage/core': '^1.0.5', // not bumped since new version is within range
+ '@backstage/core': '^1.0.6',
},
});
const packageB = await fs.readJson('/packages/b/package.json');
@@ -701,8 +711,8 @@ describe('bump', () => {
dependencies: {
'@backstage-extra/custom': '^1.1.0',
'@backstage-extra/custom-two': '^2.0.0',
- '@backstage/core': '^1.0.3', // not bumped
- '@backstage/theme': '^2.0.0', // bumped since newer
+ '@backstage/core': '^1.0.6',
+ '@backstage/theme': '^2.0.0',
},
});
});
diff --git a/packages/cli/src/commands/versions/bump.ts b/packages/cli/src/commands/versions/bump.ts
index 0e042d1cba..81f98b8421 100644
--- a/packages/cli/src/commands/versions/bump.ts
+++ b/packages/cli/src/commands/versions/bump.ts
@@ -124,13 +124,6 @@ export default async (opts: OptionValues) => {
}
for (const pkg of pkgs) {
- if (semver.satisfies(target, pkg.range)) {
- if (semver.minVersion(pkg.range)?.version !== target) {
- unlocked.push({ name, range: pkg.range, target });
- }
-
- continue;
- }
versionBumps.set(
pkg.name,
(versionBumps.get(pkg.name) ?? []).concat({
diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts
index d573f80e27..d3f1e8da75 100644
--- a/packages/cli/src/lib/bundler/server.ts
+++ b/packages/cli/src/lib/bundler/server.ts
@@ -40,6 +40,7 @@ export async function serveBundle(options: ServeOptions) {
isDev: true,
baseUrl: url,
});
+
const compiler = webpack(config);
const server = new WebpackDevServer(
@@ -60,7 +61,15 @@ export async function serveBundle(options: ServeOptions) {
// See https://github.com/facebookincubator/create-react-app/issues/387.
disableDotRule: true,
},
- https: url.protocol === 'https:',
+ https:
+ url.protocol === 'https:'
+ ? {
+ cert: options.backendConfig.getString(
+ 'app.https.certificate.cert',
+ ),
+ key: options.backendConfig.getString('app.https.certificate.key'),
+ }
+ : false,
host,
port,
proxy: pkg.proxy,
diff --git a/packages/cli/src/lib/bundler/types.ts b/packages/cli/src/lib/bundler/types.ts
index 4d6d2e5c9e..68260735f9 100644
--- a/packages/cli/src/lib/bundler/types.ts
+++ b/packages/cli/src/lib/bundler/types.ts
@@ -31,6 +31,7 @@ export type ServeOptions = BundlingPathsOptions & {
checksEnabled: boolean;
frontendConfig: Config;
frontendAppConfigs: AppConfig[];
+ backendConfig: Config;
};
export type BuildOptions = BundlingPathsOptions & {
diff --git a/packages/cli/src/lib/config.ts b/packages/cli/src/lib/config.ts
index e7ceeadf08..994714a3ce 100644
--- a/packages/cli/src/lib/config.ts
+++ b/packages/cli/src/lib/config.ts
@@ -96,11 +96,15 @@ export async function loadCliConfig(options: Options) {
});
const frontendConfig = ConfigReader.fromConfigs(frontendAppConfigs);
+ const backendAppConfigs = schema.process(appConfigs);
+ const backendConfig = ConfigReader.fromConfigs(backendAppConfigs);
+
return {
schema,
appConfigs,
frontendConfig,
frontendAppConfigs,
+ backendConfig,
};
} catch (error) {
const maybeSchemaError = error as Error & { messages?: string[] };
diff --git a/packages/cli/src/lib/create/FactoryRegistry.ts b/packages/cli/src/lib/new/FactoryRegistry.ts
similarity index 100%
rename from packages/cli/src/lib/create/FactoryRegistry.ts
rename to packages/cli/src/lib/new/FactoryRegistry.ts
diff --git a/packages/cli/src/lib/create/factories/backendPlugin.test.ts b/packages/cli/src/lib/new/factories/backendPlugin.test.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/backendPlugin.test.ts
rename to packages/cli/src/lib/new/factories/backendPlugin.test.ts
diff --git a/packages/cli/src/lib/create/factories/backendPlugin.ts b/packages/cli/src/lib/new/factories/backendPlugin.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/backendPlugin.ts
rename to packages/cli/src/lib/new/factories/backendPlugin.ts
diff --git a/packages/cli/src/lib/create/factories/common/prompts.ts b/packages/cli/src/lib/new/factories/common/prompts.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/common/prompts.ts
rename to packages/cli/src/lib/new/factories/common/prompts.ts
diff --git a/packages/cli/src/lib/create/factories/common/tasks.test.ts b/packages/cli/src/lib/new/factories/common/tasks.test.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/common/tasks.test.ts
rename to packages/cli/src/lib/new/factories/common/tasks.test.ts
diff --git a/packages/cli/src/lib/create/factories/common/tasks.ts b/packages/cli/src/lib/new/factories/common/tasks.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/common/tasks.ts
rename to packages/cli/src/lib/new/factories/common/tasks.ts
diff --git a/packages/cli/src/lib/create/factories/common/testUtils.ts b/packages/cli/src/lib/new/factories/common/testUtils.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/common/testUtils.ts
rename to packages/cli/src/lib/new/factories/common/testUtils.ts
diff --git a/packages/cli/src/lib/create/factories/frontendPlugin.test.ts b/packages/cli/src/lib/new/factories/frontendPlugin.test.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/frontendPlugin.test.ts
rename to packages/cli/src/lib/new/factories/frontendPlugin.test.ts
diff --git a/packages/cli/src/lib/create/factories/frontendPlugin.ts b/packages/cli/src/lib/new/factories/frontendPlugin.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/frontendPlugin.ts
rename to packages/cli/src/lib/new/factories/frontendPlugin.ts
diff --git a/packages/cli/src/lib/create/factories/index.ts b/packages/cli/src/lib/new/factories/index.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/index.ts
rename to packages/cli/src/lib/new/factories/index.ts
diff --git a/packages/cli/src/lib/create/factories/pluginCommon.test.ts b/packages/cli/src/lib/new/factories/pluginCommon.test.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/pluginCommon.test.ts
rename to packages/cli/src/lib/new/factories/pluginCommon.test.ts
diff --git a/packages/cli/src/lib/create/factories/pluginCommon.ts b/packages/cli/src/lib/new/factories/pluginCommon.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/pluginCommon.ts
rename to packages/cli/src/lib/new/factories/pluginCommon.ts
diff --git a/packages/cli/src/lib/create/factories/scaffolderModule.test.ts b/packages/cli/src/lib/new/factories/scaffolderModule.test.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/scaffolderModule.test.ts
rename to packages/cli/src/lib/new/factories/scaffolderModule.test.ts
diff --git a/packages/cli/src/lib/create/factories/scaffolderModule.ts b/packages/cli/src/lib/new/factories/scaffolderModule.ts
similarity index 100%
rename from packages/cli/src/lib/create/factories/scaffolderModule.ts
rename to packages/cli/src/lib/new/factories/scaffolderModule.ts
diff --git a/packages/cli/src/lib/create/types.ts b/packages/cli/src/lib/new/types.ts
similarity index 100%
rename from packages/cli/src/lib/create/types.ts
rename to packages/cli/src/lib/new/types.ts
diff --git a/packages/core-app-api/src/routing/collectors.stable.test.tsx b/packages/core-app-api/src/routing/collectors.stable.test.tsx
index 2324ea5b69..f8f71a1a9a 100644
--- a/packages/core-app-api/src/routing/collectors.stable.test.tsx
+++ b/packages/core-app-api/src/routing/collectors.stable.test.tsx
@@ -453,18 +453,19 @@ describe('discovery', () => {
);
});
- it('should throw elements within element prop contains a path', () => {
- expect(() => {
- traverseElementTree({
- root: } />,
- discoverers: [childDiscoverer, routeElementDiscoverer],
- collectors: {
- routing: routingV2Collector,
- },
- });
- }).toThrow(
- 'Elements within the element prop tree may not have paths, found "bar"',
- );
+ it('should ignore path props within route elements', () => {
+ const { routing } = traverseElementTree({
+ root: } />,
+ discoverers: [childDiscoverer, routeElementDiscoverer],
+ collectors: {
+ routing: routingV2Collector,
+ },
+ });
+ expect(sortedEntries(routing.paths)).toEqual([[ref1, 'foo']]);
+ expect(sortedEntries(routing.parents)).toEqual([[ref1, undefined]]);
+ expect(routing.objects).toEqual([
+ routeObj('foo', [ref1], [], undefined, plugin),
+ ]);
});
it('should throw when a routable extension does not have a path set', () => {
diff --git a/packages/core-app-api/src/routing/collectors.tsx b/packages/core-app-api/src/routing/collectors.tsx
index e5d71f5117..815ae534f1 100644
--- a/packages/core-app-api/src/routing/collectors.tsx
+++ b/packages/core-app-api/src/routing/collectors.tsx
@@ -53,6 +53,8 @@ interface RoutingV2CollectorContext {
isElementAncestor?: boolean;
}
+// This collects all the mount points and their plugins within an element tree.
+// Unlike regular traversal this ignores all other things, like path props and mount point gatherers.
function collectSubTree(
node: ReactNode,
entries = new Array<{ routeRef: RouteRef; plugin?: BackstagePlugin }>(),
@@ -62,12 +64,6 @@ function collectSubTree(
return;
}
- if (element.props.path) {
- throw new Error(
- `Elements within the element prop tree may not have paths, found "${element.props.path}"`,
- );
- }
-
const routeRef = getComponentData(element, 'core.mountPoint');
if (routeRef) {
const plugin = getComponentData(element, 'core.plugin');
@@ -87,6 +83,16 @@ export const routingV2Collector = createCollector(
objects: new Array(),
}),
(acc, node, parent, ctx?: RoutingV2CollectorContext) => {
+ // If we're in an element prop, ignore everything
+ if (ctx?.isElementAncestor) {
+ return ctx;
+ }
+
+ // Start ignoring everything if we enter an element prop
+ if (parent?.props.element === node) {
+ return { ...ctx, isElementAncestor: true };
+ }
+
const pathProp: unknown = node.props?.path;
const mountPoint = getComponentData(node, 'core.mountPoint');
@@ -98,15 +104,6 @@ export const routingV2Collector = createCollector(
);
}
- // If we're in an element prop, ignore everything
- if (ctx?.isElementAncestor) {
- return ctx;
- }
- // Start ignoring everything if we enter an element prop
- if (parent?.props.element === node) {
- return { ...ctx, isElementAncestor: true };
- }
-
const parentChildren = ctx?.obj?.children ?? acc.objects;
if (pathProp !== undefined) {
diff --git a/packages/create-app/templates/default-app/package.json.hbs b/packages/create-app/templates/default-app/package.json.hbs
index 47fb0d622f..9e20ebfa64 100644
--- a/packages/create-app/templates/default-app/package.json.hbs
+++ b/packages/create-app/templates/default-app/package.json.hbs
@@ -13,7 +13,7 @@
"build-image": "yarn workspace backend build-image",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
- "clean": "backstage-cli clean && lerna run clean",
+ "clean": "backstage-cli repo clean",
"diff": "lerna run diff --",
"test": "backstage-cli test",
"test:all": "lerna run test -- --coverage",
@@ -21,7 +21,7 @@
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"create-plugin": "backstage-cli create-plugin --scope internal",
- "remove-plugin": "backstage-cli remove-plugin"
+ "new": "backstage-cli new --scope internal"
},
"workspaces": {
"packages": [
diff --git a/plugins/search-react/api-report.md b/plugins/search-react/api-report.md
index e4afee45ca..7d5e64757b 100644
--- a/plugins/search-react/api-report.md
+++ b/plugins/search-react/api-report.md
@@ -7,8 +7,11 @@
import { ApiRef } from '@backstage/core-plugin-api';
import { AsyncState } from 'react-use/lib/useAsync';
+import { AutocompleteProps } from '@material-ui/lab';
+import { ForwardRefExoticComponent } from 'react';
import { InputBaseProps } from '@material-ui/core';
import { JsonObject } from '@backstage/types';
+import { ListItemTextProps } from '@material-ui/core';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
import { ReactElement } from 'react';
@@ -74,6 +77,34 @@ export interface SearchApi {
// @public (undocumented)
export const searchApiRef: ApiRef;
+// @public
+export const SearchAutocomplete: SearchAutocompleteComponent;
+
+// @public
+export type SearchAutocompleteComponent =