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:
@@ -14,7 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { findPaths } from '@backstage/cli-common';
|
||||
import { targetPaths, findOwnPaths } from '@backstage/cli-common';
|
||||
|
||||
const ownPaths = findOwnPaths(__dirname);
|
||||
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
export const paths = findPaths(__dirname);
|
||||
export const paths = {
|
||||
get ownDir() {
|
||||
return ownPaths.resolve();
|
||||
},
|
||||
get ownRoot() {
|
||||
return ownPaths.resolveRoot();
|
||||
},
|
||||
get targetDir() {
|
||||
return targetPaths.resolve();
|
||||
},
|
||||
get targetRoot() {
|
||||
return targetPaths.resolveRoot();
|
||||
},
|
||||
resolveOwn: ownPaths.resolve,
|
||||
resolveOwnRoot: ownPaths.resolveRoot,
|
||||
resolveTarget: targetPaths.resolve,
|
||||
resolveTargetRoot: targetPaths.resolveRoot,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user