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:
@@ -16,17 +16,16 @@
|
||||
|
||||
import { relative as relativePath } from 'node:path';
|
||||
import { OptionValues } from 'commander';
|
||||
import { findPaths, run } from '@backstage/cli-common';
|
||||
import { findOwnPaths, run } from '@backstage/cli-common';
|
||||
import { platform } from 'node:os';
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const paths = findPaths(__dirname);
|
||||
|
||||
export function createCodemodAction(name: string) {
|
||||
return async (dirs: string[], opts: OptionValues) => {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const paths = findOwnPaths(__dirname);
|
||||
const transformPath = relativePath(
|
||||
process.cwd(),
|
||||
paths.resolveOwn('transforms', `${name}.js`),
|
||||
paths.resolve('transforms', `${name}.js`),
|
||||
);
|
||||
|
||||
const args = [
|
||||
|
||||
Reference in New Issue
Block a user