From ee49cb4af989b2148fc4a0f1a606c81519562ddf Mon Sep 17 00:00:00 2001 From: davidgiga1993 Date: Mon, 16 Dec 2024 11:22:56 +0100 Subject: [PATCH] fix: wrong usage of fslib causes wrong paths to be used on windows Signed-off-by: davidgiga1993 --- .changeset/pretty-pets-deliver.md | 5 +++++ packages/yarn-plugin/src/util.ts | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changeset/pretty-pets-deliver.md diff --git a/.changeset/pretty-pets-deliver.md b/.changeset/pretty-pets-deliver.md new file mode 100644 index 0000000000..dc87690148 --- /dev/null +++ b/.changeset/pretty-pets-deliver.md @@ -0,0 +1,5 @@ +--- +'yarn-plugin-backstage': minor +--- + +Fixed windows path resolution on windows diff --git a/packages/yarn-plugin/src/util.ts b/packages/yarn-plugin/src/util.ts index ee89a647e3..23ce55ac80 100644 --- a/packages/yarn-plugin/src/util.ts +++ b/packages/yarn-plugin/src/util.ts @@ -20,7 +20,7 @@ import { httpUtils, structUtils, } from '@yarnpkg/core'; -import { ppath, xfs } from '@yarnpkg/fslib'; +import { ppath, npath, xfs } from '@yarnpkg/fslib'; import { valid as semverValid } from 'semver'; import { BACKSTAGE_JSON, findPaths } from '@backstage/cli-common'; import { getManifestByVersion } from '@backstage/release-manifests'; @@ -28,7 +28,9 @@ import { getManifestByVersion } from '@backstage/release-manifests'; import { PROTOCOL } from './constants'; export const getCurrentBackstageVersion = () => { - const workspaceRoot = ppath.resolve(findPaths(ppath.cwd()).targetRoot); + const workspaceRoot = npath.toPortablePath( + findPaths(npath.fromPortablePath(ppath.cwd())).targetRoot, + ); const backstageJson = xfs.readJsonSync( ppath.join(workspaceRoot, BACKSTAGE_JSON),