diff --git a/.changeset/kind-cougars-allow.md b/.changeset/kind-cougars-allow.md new file mode 100644 index 0000000000..d37c4c5cf2 --- /dev/null +++ b/.changeset/kind-cougars-allow.md @@ -0,0 +1,14 @@ +--- +'@backstage/plugin-devtools-backend': patch +--- + +Add DevTools configuration to enable dependency listing to be filtered with custom prefixes. For instance, in your `app-config.yaml`: + +```yaml +devTools: + info: + packagePrefixes: + - @backstage/ + - @roadiehq/backstage- + - @spotify/backstage- +``` diff --git a/plugins/devtools-backend/config.d.ts b/plugins/devtools-backend/config.d.ts index 15e70afcf8..9fc7cf1762 100644 --- a/plugins/devtools-backend/config.d.ts +++ b/plugins/devtools-backend/config.d.ts @@ -40,5 +40,15 @@ export interface Config { target: string; }>; }; + /** + * Info configuration + */ + info?: { + /** + * A list of package prefixes that DevTools will use for filtering all available dependencies + * (default is ["@backstage"]) + */ + packagePrefixes?: string[]; + }; }; } diff --git a/plugins/devtools-backend/src/api/DevToolsBackendApi.ts b/plugins/devtools-backend/src/api/DevToolsBackendApi.ts index efd0407b31..c1b1a1fa9a 100644 --- a/plugins/devtools-backend/src/api/DevToolsBackendApi.ts +++ b/plugins/devtools-backend/src/api/DevToolsBackendApi.ts @@ -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 = ['@backstage', '@internal'].concat( + this.config.getOptionalStringArray('devTools.info.packagePrefixes') ?? [], + ); + const deps = [...lockfile.keys()].filter(n => + prefixes.some(prefix => n.startsWith(prefix)), + ); const infoDependencies: PackageDependency[] = []; for (const dep of deps) { diff --git a/plugins/devtools/README.md b/plugins/devtools/README.md index 09e76caaa4..c3c3fd9240 100644 --- a/plugins/devtools/README.md +++ b/plugins/devtools/README.md @@ -408,11 +408,23 @@ export const customDevToolsPage = ; ## Configuration -The following sections outline the configuration for the DevTools plugin +The following sections outline the configuration for the DevTools plugin. + +### Package Dependencies + +By default, only packages with names starting with `@backstage` and `@internal` will be listed on the main "Info" tab. If you would like additional packages to be listed, you can specify the package prefixes (not regular expressions) in your `app-config.yaml`. For example, to not only provide version information about backstage plugins provided by the core application (`@backstage/*` modules) but also `@roadiehq` and `@spotify` plugins, you can specify this configuration: + +```yaml +devTools: + info: + packagePrefixes: + - @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: