From b42ccffafe2daeaae7c69849e6f67c497fcf5209 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 16 Feb 2022 16:51:19 +0100 Subject: [PATCH] cli: fix for backend bundle build ignoring building of the app Signed-off-by: Patrik Oldsberg --- .changeset/polite-bulldogs-repeat.md | 2 ++ .../cli/src/lib/packager/createDistWorkspace.ts | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.changeset/polite-bulldogs-repeat.md b/.changeset/polite-bulldogs-repeat.md index cf551d17f4..c4e3babe30 100644 --- a/.changeset/polite-bulldogs-repeat.md +++ b/.changeset/polite-bulldogs-repeat.md @@ -13,3 +13,5 @@ The `backstage-cli migrate package-scripts` received several tweaks to make it m The `script` command category has been renamed to `package`. The `backstage-cli package build` command set an incorrect target directory for `app` and `backend` packages, which has been fixed. + +The `backend:bundle` and `repo build` command for the `backend` role was previously ignoring building of bundled packages that had migrated to use package roles and the standard build script, this has now been fixed. diff --git a/packages/cli/src/lib/packager/createDistWorkspace.ts b/packages/cli/src/lib/packager/createDistWorkspace.ts index ef375387ef..bce6c5c14c 100644 --- a/packages/cli/src/lib/packager/createDistWorkspace.ts +++ b/packages/cli/src/lib/packager/createDistWorkspace.ts @@ -38,6 +38,7 @@ import { Output, } from '../builder'; import { copyPackageDist } from './copyPackageDist'; +import { getRoleInfo } from '../role'; // These packages aren't safe to pack in parallel since the CLI depends on them const UNSAFE_PACKAGES = [ @@ -131,7 +132,9 @@ export async function createDistWorkspace( } const role = pkg.packageJson.backstage?.role; if (!role) { - console.warn(`Ignored ${pkg.packageJson.name} because it has no role`); + console.warn( + `Building ${pkg.packageJson.name} separately because it has no role`, + ); customBuild.push(pkg.packageJson.name); continue; } @@ -144,7 +147,15 @@ export async function createDistWorkspace( if (!buildScript.startsWith('backstage-cli package build')) { console.warn( - `Ignored ${pkg.packageJson.name} because it has a custom build script, '${buildScript}'`, + `Building ${pkg.packageJson.name} separately because it has a custom build script, '${buildScript}'`, + ); + customBuild.push(pkg.packageJson.name); + continue; + } + + if (getRoleInfo(role).output.includes('bundle')) { + console.warn( + `Building ${pkg.packageJson.name} separately because it is a bundled package`, ); customBuild.push(pkg.packageJson.name); continue;