Allow package prefixes to be customized for DevTools dependency listing
Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-devtools-backend': patch
|
||||
---
|
||||
|
||||
Add DevTools configuration to enable dependency listing to be filtered with custom prefixes
|
||||
Vendored
+5
@@ -40,5 +40,10 @@ export interface Config {
|
||||
target: string;
|
||||
}>;
|
||||
};
|
||||
/**
|
||||
* A list of package prefixes that DevTools will use for filtering all available dependencies
|
||||
* (default is ["@backstage"])
|
||||
*/
|
||||
packagePrefixes?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -219,7 +219,12 @@ export class DevToolsBackendApi {
|
||||
const lockfilePath = paths.resolveTargetRoot('yarn.lock');
|
||||
const lockfile = await Lockfile.load(lockfilePath);
|
||||
|
||||
const deps = [...lockfile.keys()].filter(n => n.startsWith('@backstage/'));
|
||||
const prefixes = this.config.getOptionalStringArray(
|
||||
'devTools.packagePrefixes',
|
||||
) ?? ['@backstage/'];
|
||||
const deps = [...lockfile.keys()].filter(n =>
|
||||
prefixes.some(prefix => n.startsWith(prefix)),
|
||||
);
|
||||
|
||||
const infoDependencies: PackageDependency[] = [];
|
||||
for (const dep of deps) {
|
||||
|
||||
@@ -410,9 +410,21 @@ export const customDevToolsPage = <DevToolsPage />;
|
||||
|
||||
The following sections outline the configuration for the DevTools plugin
|
||||
|
||||
### Package Dependencies
|
||||
|
||||
By default, only packages with names starting with `@backstage/` will be listed on the main "Info" tab. If you would like additional packages to be listed, you can specify the package prefixes in your `app-config.yaml`. For example, to include backstage plugins provided by the core application as well as `@roadiehq` and `@spotify`:
|
||||
|
||||
```yaml
|
||||
devTools:
|
||||
packagePrefixes:
|
||||
- @backstage/
|
||||
- @roadiehq/backstage-
|
||||
- @spotify/backstage-
|
||||
```
|
||||
|
||||
### External Dependencies Configuration
|
||||
|
||||
If you decide to use the External Dependencies tab then you'll need to setup the configuration for it in your `app-config.yaml`, if there is no config setup then the tab will be empty. Here's an example:
|
||||
If you decide to use the External Dependencies tab then you'll need to setup the configuration for it in your `app-config.yaml`. If there is no endpoints configured, then the tab will be empty. Here's an example:
|
||||
|
||||
```yaml
|
||||
devTools:
|
||||
|
||||
Reference in New Issue
Block a user