Resolve --config options against both current directory and monorepo root.

Signed-off-by: Axel Hecht <axel@pike.org>
This commit is contained in:
Axel Hecht
2023-03-08 20:09:31 +01:00
parent 5896463fb2
commit e9e9c7962f
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Resolve config options against both the current directory and the monorepo root directory.
+6 -1
View File
@@ -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 });
}
});