From 11e139c7ec42d77dee96af9bf3afd71bc7f717a2 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Sat, 10 Feb 2024 13:58:27 +0000 Subject: [PATCH] fix(js): nx release-version resolve-version-spec should normalize fetchSpec (#21710) --- .../release-version/utils/resolve-version-spec.spec.ts | 2 +- .../generators/release-version/utils/resolve-version-spec.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/js/src/generators/release-version/utils/resolve-version-spec.spec.ts b/packages/js/src/generators/release-version/utils/resolve-version-spec.spec.ts index a767f8e970b06..72c95886ed3e7 100644 --- a/packages/js/src/generators/release-version/utils/resolve-version-spec.spec.ts +++ b/packages/js/src/generators/release-version/utils/resolve-version-spec.spec.ts @@ -76,7 +76,7 @@ describe('resolveVersionSpec()', () => { 'projectA', '1.0.0', 'link:../projectB', - '/packages/fuck' + '/packages/projectB' ) ).toEqual(expect.stringContaining(join('/packages/projectB'))); }); diff --git a/packages/js/src/generators/release-version/utils/resolve-version-spec.ts b/packages/js/src/generators/release-version/utils/resolve-version-spec.ts index 81a4d87ace2d5..324887fb3e583 100644 --- a/packages/js/src/generators/release-version/utils/resolve-version-spec.ts +++ b/packages/js/src/generators/release-version/utils/resolve-version-spec.ts @@ -1,4 +1,5 @@ import * as npa from 'npm-package-arg'; +import { normalizePath } from '@nx/devkit'; export function resolveVersionSpec( name: string, @@ -26,5 +27,7 @@ export function resolveVersionSpec( const npaResult = npa.resolve(name, spec, location); - return npaResult.fetchSpec; + return npaResult.fetchSpec.includes('\\') + ? normalizePath(npaResult.fetchSpec) + : npaResult.fetchSpec; }