From 366a6b98fc567d11a254f9f03fea4c9d2fa84643 Mon Sep 17 00:00:00 2001 From: Brian Phillips <28457+brianphillips@users.noreply.github.com> Date: Mon, 24 Jul 2023 21:44:26 -0500 Subject: [PATCH] code review feedback Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com> --- .changeset/kind-cougars-allow.md | 11 ++++++++++- plugins/devtools-backend/config.d.ts | 11 ++++++++--- .../devtools-backend/src/api/DevToolsBackendApi.ts | 6 +++--- plugins/devtools/README.md | 12 ++++++------ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.changeset/kind-cougars-allow.md b/.changeset/kind-cougars-allow.md index 058bec5f2e..d37c4c5cf2 100644 --- a/.changeset/kind-cougars-allow.md +++ b/.changeset/kind-cougars-allow.md @@ -2,4 +2,13 @@ '@backstage/plugin-devtools-backend': patch --- -Add DevTools configuration to enable dependency listing to be filtered with custom prefixes +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 79d1d6159f..9fc7cf1762 100644 --- a/plugins/devtools-backend/config.d.ts +++ b/plugins/devtools-backend/config.d.ts @@ -41,9 +41,14 @@ export interface Config { }>; }; /** - * A list of package prefixes that DevTools will use for filtering all available dependencies - * (default is ["@backstage"]) + * Info configuration */ - packagePrefixes?: string[]; + 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 eb5dc9f860..c1b1a1fa9a 100644 --- a/plugins/devtools-backend/src/api/DevToolsBackendApi.ts +++ b/plugins/devtools-backend/src/api/DevToolsBackendApi.ts @@ -219,9 +219,9 @@ export class DevToolsBackendApi { const lockfilePath = paths.resolveTargetRoot('yarn.lock'); const lockfile = await Lockfile.load(lockfilePath); - const prefixes = this.config.getOptionalStringArray( - 'devTools.packagePrefixes', - ) ?? ['@backstage/']; + const prefixes = ['@backstage', '@internal'].concat( + this.config.getOptionalStringArray('devTools.info.packagePrefixes') ?? [], + ); const deps = [...lockfile.keys()].filter(n => prefixes.some(prefix => n.startsWith(prefix)), ); diff --git a/plugins/devtools/README.md b/plugins/devtools/README.md index e59f4df132..c3c3fd9240 100644 --- a/plugins/devtools/README.md +++ b/plugins/devtools/README.md @@ -408,18 +408,18 @@ 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/` 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`: +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: - packagePrefixes: - - @backstage/ - - @roadiehq/backstage- - - @spotify/backstage- + info: + packagePrefixes: + - @roadiehq/backstage- + - @spotify/backstage- ``` ### External Dependencies Configuration