From d6c4547a70b443f4e3738e2405cfe9e1b91e8829 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 4 Nov 2022 11:13:30 -0400 Subject: [PATCH] fix(core): move affected positional arguments args back to util (#12994) --- packages/nx/src/command-line/nx-commands.ts | 17 ----------------- packages/nx/src/utils/command-line-utils.ts | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/nx/src/command-line/nx-commands.ts b/packages/nx/src/command-line/nx-commands.ts index 7750d9499a7f0..a25f1db975009 100644 --- a/packages/nx/src/command-line/nx-commands.ts +++ b/packages/nx/src/command-line/nx-commands.ts @@ -531,23 +531,6 @@ function withAffectedOptions(yargs: yargs.Argv): yargs.Argv { untracked: ['uncommitted', 'files', 'base', 'head', 'all'], uncommitted: ['files', 'untracked', 'base', 'head', 'all'], all: ['files', 'untracked', 'uncommitted', 'base', 'head'], - }) - .check((nxArgs) => { - if ( - !nxArgs.files && - !nxArgs.uncommitted && - !nxArgs.untracked && - !nxArgs.base && - !nxArgs.head && - !nxArgs.all && - nxArgs._ && - nxArgs._.length >= 3 - ) { - throw new Error( - `Nx no longer supports using positional arguments for base and head. Please use --base and --head instead.` - ); - } - return true; }); } diff --git a/packages/nx/src/utils/command-line-utils.ts b/packages/nx/src/utils/command-line-utils.ts index ea6f71d587727..90ce3bf373d1e 100644 --- a/packages/nx/src/utils/command-line-utils.ts +++ b/packages/nx/src/utils/command-line-utils.ts @@ -100,6 +100,21 @@ export function splitArgsIntoNxArgsAndOverrides( }); } + if ( + !nxArgs.files && + !nxArgs.uncommitted && + !nxArgs.untracked && + !nxArgs.base && + !nxArgs.head && + !nxArgs.all && + overrides._ && + overrides._.length >= 2 + ) { + throw new Error( + `Nx no longer supports using positional arguments for base and head. Please use --base and --head instead.` + ); + } + // Allow setting base and head via environment variables (lower priority then direct command arguments) if (!nxArgs.base && process.env.NX_BASE) { nxArgs.base = process.env.NX_BASE;