Allow explicit package list & add UI

Co-authored-by: Vincenzo Scamporlino <vinzscam@users.noreply.github.com>
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2023-07-17 15:49:45 +02:00
committed by Patrik Oldsberg
parent 08e36cdab3
commit b9f81c945c
4 changed files with 55 additions and 5 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ export async function createConfig(
if (extraPackages.length > 0) {
const requirePackageScript = extraPackages
?.map(pkg => `require('${pkg}')`)
?.map(pkg => `{name: '${pkg}', module: require('${pkg}')}`)
.join(',');
plugins.push(
+18 -1
View File
@@ -42,7 +42,7 @@ export async function serveBundle(options: ServeOptions) {
// TODO: proper
// Assumption for config string based on https://github.com/backstage/backstage/issues/18372 ^
const packageDetectionMode = options.fullConfig.getOptionalString(
const packageDetectionMode = options.fullConfig.getOptional(
'app.experimental.packages',
);
const extraPackages = [];
@@ -60,6 +60,23 @@ export async function serveBundle(options: ServeOptions) {
extraPackages.push(depName);
}
}
} else {
const packagesList = Array.isArray(packageDetectionMode)
? packageDetectionMode
: [];
for (const depName of packagesList ?? []) {
const depPackageJson: BackstagePackageJson = require(require.resolve(
`${depName}/package.json`,
{ paths: [paths.targetPath] },
));
if (
['frontend-plugin', 'frontend-plugin-module'].includes(
depPackageJson.backstage?.role || '',
)
) {
extraPackages.push(depName);
}
}
}
if (options.verifyVersions) {
const lockfile = await Lockfile.load(