Skip to content

Commit

Permalink
fix(core): move affected positional arguments args back to util (#12994)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Nov 4, 2022
1 parent 0a28a25 commit d6c4547
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
17 changes: 0 additions & 17 deletions packages/nx/src/command-line/nx-commands.ts
Expand Up @@ -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;
});
}

Expand Down
15 changes: 15 additions & 0 deletions packages/nx/src/utils/command-line-utils.ts
Expand Up @@ -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;
Expand Down

1 comment on commit d6c4547

@vercel
Copy link

@vercel vercel bot commented on d6c4547 Nov 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app

Please sign in to comment.