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:
@@ -41,6 +41,12 @@ jest.mock('@backstage/cli-common', () => {
|
||||
findPaths: jest.fn(),
|
||||
findOwnPaths: () => mockOwnPaths,
|
||||
targetPaths: {
|
||||
get dir() {
|
||||
return MOCK_TARGET_DIR;
|
||||
},
|
||||
get rootDir() {
|
||||
return '/mock/target-root';
|
||||
},
|
||||
resolve: (...paths: string[]) =>
|
||||
pathModule.resolve(MOCK_TARGET_DIR, ...paths),
|
||||
resolveRoot: (...paths: string[]) =>
|
||||
|
||||
@@ -76,8 +76,8 @@ export default async (opts: OptionValues): Promise<void> => {
|
||||
// Use `--path` argument as application directory when specified, otherwise
|
||||
// create a directory using `answers.name`
|
||||
const appDir = opts.path
|
||||
? resolvePath(targetPaths.resolve(), opts.path)
|
||||
: resolvePath(targetPaths.resolve(), answers.name);
|
||||
? resolvePath(targetPaths.dir, opts.path)
|
||||
: resolvePath(targetPaths.dir, answers.name);
|
||||
|
||||
Task.log();
|
||||
Task.log('Creating the app...');
|
||||
@@ -100,7 +100,7 @@ export default async (opts: OptionValues): Promise<void> => {
|
||||
// Template to temporary location, and then move files
|
||||
|
||||
Task.section('Checking if the directory is available');
|
||||
await checkAppExistsTask(targetPaths.resolve(), answers.name);
|
||||
await checkAppExistsTask(targetPaths.dir, answers.name);
|
||||
|
||||
Task.section('Creating a temporary app directory');
|
||||
const tempDir = await fs.mkdtemp(resolvePath(os.tmpdir(), answers.name));
|
||||
|
||||
Reference in New Issue
Block a user