Skip to content

Commit

Permalink
cli: fix for backend bundle building all packages
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
  • Loading branch information
Rugvip committed Nov 13, 2021
1 parent af855da commit 4ca3542
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-cameras-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---

Fixed a bug where calling `backstage-cli backend:bundle --build-dependencies` with no dependencies to be built would cause all monorepo packages to be built instead.
23 changes: 12 additions & 11 deletions packages/cli/src/lib/packager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,19 @@ export async function createDistWorkspace(

if (options.buildDependencies) {
const exclude = options.buildExcludes ?? [];
const scopeArgs = targets
.filter(target => !exclude.includes(target.name))
.flatMap(target => ['--scope', target.name]);

const lernaArgs =
options.parallel && Number.isInteger(options.parallel)
? ['--concurrency', options.parallel.toString()]
: [];

await run('yarn', ['lerna', ...lernaArgs, 'run', ...scopeArgs, 'build'], {
cwd: paths.targetRoot,
});
const toBuild = targets.filter(target => !exclude.includes(target.name));
if (toBuild.length > 0) {
const scopeArgs = toBuild.flatMap(target => ['--scope', target.name]);
const lernaArgs =
options.parallel && Number.isInteger(options.parallel)
? ['--concurrency', options.parallel.toString()]
: [];

await run('yarn', ['lerna', ...lernaArgs, 'run', ...scopeArgs, 'build'], {
cwd: paths.targetRoot,
});
}
}

await moveToDistWorkspace(targetDir, targets);
Expand Down

0 comments on commit 4ca3542

Please sign in to comment.