From 24de089b74f85d5388d71312ce297ed6a766c8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Wed, 6 Sep 2023 19:17:35 +0100 Subject: [PATCH] fix(misc): calculate cwd relative path correctly for generators and executors (#18933) (cherry picked from commit ace8f8cf97c9ad65a663cf9e2acc900a954a377a) --- packages/devkit/src/executors/read-target-options.ts | 2 +- packages/nx/src/command-line/generate/generate.ts | 2 +- packages/nx/src/command-line/run/run.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/devkit/src/executors/read-target-options.ts b/packages/devkit/src/executors/read-target-options.ts index 57c7a8479b64da..a760f001eabf48 100644 --- a/packages/devkit/src/executors/read-target-options.ts +++ b/packages/devkit/src/executors/read-target-options.ts @@ -57,6 +57,6 @@ export function readTargetOptions( targetConfiguration, schema, defaultProject, - relative(context.cwd, context.root) + relative(context.root, context.cwd) ) as T; } diff --git a/packages/nx/src/command-line/generate/generate.ts b/packages/nx/src/command-line/generate/generate.ts index 07565946919fd8..d3181c383c01bb 100644 --- a/packages/nx/src/command-line/generate/generate.ts +++ b/packages/nx/src/command-line/generate/generate.ts @@ -364,7 +364,7 @@ export async function generate(cwd: string, args: { [k: string]: any }) { projectsConfigurations, nxJsonConfiguration ), - relative(cwd, workspaceRoot), + relative(workspaceRoot, cwd), verbose ); diff --git a/packages/nx/src/command-line/run/run.ts b/packages/nx/src/command-line/run/run.ts index 012f3f9bf310a5..001e025d05ad58 100644 --- a/packages/nx/src/command-line/run/run.ts +++ b/packages/nx/src/command-line/run/run.ts @@ -150,7 +150,7 @@ async function runExecutorInternal( targetConfig, schema, project, - relative(cwd, root), + relative(root, cwd), isVerbose );