From e9e9c7962f76131f3bf5025682612fd4b1a800e3 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Wed, 8 Mar 2023 20:09:31 +0100 Subject: [PATCH] Resolve --config options against both current directory and monorepo root. Signed-off-by: Axel Hecht --- .changeset/chilled-bobcats-repeat.md | 5 +++++ packages/cli/src/lib/config.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/chilled-bobcats-repeat.md diff --git a/.changeset/chilled-bobcats-repeat.md b/.changeset/chilled-bobcats-repeat.md new file mode 100644 index 0000000000..572a82b589 --- /dev/null +++ b/.changeset/chilled-bobcats-repeat.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Resolve config options against both the current directory and the monorepo root directory. diff --git a/packages/cli/src/lib/config.ts b/packages/cli/src/lib/config.ts index c813ce59fd..9bb32fa481 100644 --- a/packages/cli/src/lib/config.ts +++ b/packages/cli/src/lib/config.ts @@ -24,6 +24,7 @@ import { paths } from './paths'; import { isValidUrl } from './urls'; import { getPackages } from '@manypkg/get-packages'; import { PackageGraph } from './monorepo'; +import { pathExistsSync } from 'fs-extra'; type Options = { args: string[]; @@ -38,7 +39,11 @@ export async function loadCliConfig(options: Options) { const configTargets: ConfigTarget[] = []; options.args.forEach(arg => { if (!isValidUrl(arg)) { - configTargets.push({ path: paths.resolveTargetRoot(arg) }); + let path = paths.resolveTarget(arg); + if (!pathExistsSync(path)) { + path = paths.resolveOwnRoot(arg); + } + configTargets.push({ path }); } });