Merge pull request #18755 from brianphillips/devtools-spotify-plugins

Allow package prefixes to be customized for DevTools dependency listing
This commit is contained in:
Andre Wanlin
2023-07-28 12:59:54 -05:00
committed by GitHub
4 changed files with 44 additions and 3 deletions
+10
View File
@@ -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[];
};
};
}
@@ -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) {