Replace findPaths with targetPaths and findOwnPaths

Split the path resolution API in @backstage/cli-common into
targetPaths (cwd-based singleton) and findOwnPaths (package-relative).
Migrate all consumers across the repo away from the deprecated findPaths.

Rename TargetPaths/OwnPaths properties to resolve/resolveRoot,
removing the redundant type prefix from property names.

Make findOwnPaths calls lazy in modules - called inside functions
rather than at module scope.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Patrik Oldsberg
2026-02-21 15:16:58 +01:00
parent 29e91e9159
commit 70fc178697
66 changed files with 311 additions and 274 deletions
@@ -27,7 +27,7 @@ import {
} from './RemoteConfigSource';
import { ConfigSource, SubstitutionFunc } from './types';
import { ObservableConfigProxy } from './ObservableConfigProxy';
import { findPaths } from '@backstage/cli-common';
import { targetPaths } from '@backstage/cli-common';
/**
* A target to read configuration from.
@@ -157,7 +157,7 @@ export class ConfigSources {
static defaultForTargets(
options: ConfigSourcesDefaultForTargetsOptions,
): ConfigSource {
const rootDir = options.rootDir ?? findPaths(process.cwd()).targetRoot;
const rootDir = options.rootDir ?? targetPaths.resolveRoot();
const argSources = options.targets.map(arg => {
if (arg.type === 'url') {