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
@@ -17,7 +17,7 @@
import { OptionValues } from 'commander';
import path from 'node:path';
import openBrowser from 'react-dev-utils/openBrowser';
import { findPaths, RunOnOutput } from '@backstage/cli-common';
import { findOwnPaths, RunOnOutput } from '@backstage/cli-common';
import HTTPServer from '../../lib/httpServer';
import { runMkdocsServer } from '../../lib/mkdocsServer';
import { createLogger } from '../../lib/utility';
@@ -39,8 +39,7 @@ function findPreviewBundlePath(): string {
// This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.
// Within the extracted directory, run `npm install --only=prod`.
// Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.
// eslint-disable-next-line no-restricted-syntax
return findPaths(__dirname).resolveOwn('dist/embedded-app');
return findOwnPaths(__dirname).resolve('dist/embedded-app');
}
}