fix: Support workspaces in CLIs

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
This commit is contained in:
Gabriel Dugny
2026-01-29 10:24:31 +01:00
parent ebd4630702
commit a9d23c4a32
13 changed files with 79 additions and 62 deletions
+3 -3
View File
@@ -20,6 +20,7 @@ const crypto = require('node:crypto');
const glob = require('node:util').promisify(require('glob'));
const { version } = require('../package.json');
const paths = require('@backstage/cli-common').findPaths(process.cwd());
const { getWorkspacesPatterns } = require('@backstage/cli-common');
const {
getJestEnvironment,
getJestMajorVersion,
@@ -336,11 +337,10 @@ async function getRootConfig() {
rejectFrontendNetworkRequests,
};
const workspacePatterns =
rootPkgJson.workspaces && rootPkgJson.workspaces.packages;
const workspacePatterns = getWorkspacesPatterns(rootPkgJson);
// Check if we're running within a specific monorepo package. In that case just get the single project config.
if (!workspacePatterns || paths.targetRoot !== paths.targetDir) {
if (workspacePatterns.length === 0 || paths.targetRoot !== paths.targetDir) {
return getProjectConfig(
paths.targetDir,
{