Address PR review comments

- Refactor targetPaths/findOwnPaths to class-based implementations with
  unified caching and .dir/.rootDir properties alongside resolve methods
- Replace jest.mock with jest.spyOn in plugin-manager.test.ts
- Remove paths compatibility wrapper from repo-tools, migrate all internal
  consumers to use targetPaths from @backstage/cli-common directly
- Fix changeset package name (@techdocs/cli not @backstage/techdocs-cli)
- Add migration examples to cli-common changeset
- Update API report for cli-common

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-22 13:47:49 +01:00
parent 70fc178697
commit 07816d67f3
68 changed files with 394 additions and 321 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ describe('Backstage yarn plugin', () => {
let initialLockFileContent: string | undefined;
beforeAll(async () => {
const targetRoot = targetPaths.resolveRoot();
const targetRoot = targetPaths.rootDir;
await executeCommand('yarn', ['build'], {
cwd: joinPath(targetRoot, 'packages/yarn-plugin'),
});
@@ -50,6 +50,12 @@ describe('getWorkspaceRoot', () => {
jest.doMock('@backstage/cli-common', () => ({
...jest.requireActual('@backstage/cli-common'),
targetPaths: {
get dir() {
return mockResolveRoot();
},
get rootDir() {
return mockResolveRoot();
},
resolveRoot: mockResolveRoot,
},
}));
@@ -18,5 +18,5 @@ import { npath } from '@yarnpkg/fslib';
import { targetPaths } from '@backstage/cli-common';
export const getWorkspaceRoot = () => {
return npath.toPortablePath(targetPaths.resolveRoot());
return npath.toPortablePath(targetPaths.rootDir);
};