Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): move affected positional arguments args back to util #12994

Merged
merged 1 commit into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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