fix(misc): add --verbose support to nx graph (#22889)
This commit is contained in:
parent
595ea21424
commit
a927e935a9
@ -159,6 +159,12 @@ Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Prints additional information about the commands (e.g., stack traces)
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -159,6 +159,12 @@ Type: `boolean`
|
||||
|
||||
Untracked changes
|
||||
|
||||
### verbose
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Prints additional information about the commands (e.g., stack traces)
|
||||
|
||||
### version
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
@ -3,6 +3,7 @@ import { linkToNxDevAndExamples } from '../yargs-utils/documentation';
|
||||
import {
|
||||
withAffectedOptions,
|
||||
withDepGraphOptions,
|
||||
withVerbose,
|
||||
} from '../yargs-utils/shared-options';
|
||||
|
||||
export const yargsDepGraphCommand: CommandModule = {
|
||||
@ -11,7 +12,7 @@ export const yargsDepGraphCommand: CommandModule = {
|
||||
aliases: ['dep-graph'],
|
||||
builder: (yargs) =>
|
||||
linkToNxDevAndExamples(
|
||||
withAffectedOptions(withDepGraphOptions(yargs)),
|
||||
withVerbose(withAffectedOptions(withDepGraphOptions(yargs))),
|
||||
'dep-graph'
|
||||
)
|
||||
.option('affected', {
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import type { ProjectGraphProjectNode } from '../../config/project-graph';
|
||||
import { CommandModule, showHelp } from 'yargs';
|
||||
import { parseCSV, withAffectedOptions } from '../yargs-utils/shared-options';
|
||||
import {
|
||||
parseCSV,
|
||||
withAffectedOptions,
|
||||
withVerbose,
|
||||
} from '../yargs-utils/shared-options';
|
||||
import { handleErrors } from '../../utils/params';
|
||||
|
||||
export interface NxShowArgs {
|
||||
@ -64,7 +68,7 @@ const showProjectsCommand: CommandModule<NxShowArgs, ShowProjectsOptions> = {
|
||||
command: 'projects',
|
||||
describe: 'Show a list of projects in the workspace',
|
||||
builder: (yargs) =>
|
||||
withAffectedOptions(yargs)
|
||||
withVerbose(withAffectedOptions(yargs))
|
||||
.option('affected', {
|
||||
type: 'boolean',
|
||||
description: 'Show only affected projects',
|
||||
@ -86,11 +90,6 @@ const showProjectsCommand: CommandModule<NxShowArgs, ShowProjectsOptions> = {
|
||||
description: 'Select only projects of the given type',
|
||||
choices: ['app', 'lib', 'e2e'],
|
||||
})
|
||||
.option('verbose', {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Prints additional information about the commands (e.g., stack traces)',
|
||||
})
|
||||
.implies('untracked', 'affected')
|
||||
.implies('uncommitted', 'affected')
|
||||
.implies('files', 'affected')
|
||||
|
||||
@ -30,7 +30,7 @@ export interface RunOptions {
|
||||
}
|
||||
|
||||
export function withRunOptions<T>(yargs: Argv<T>): Argv<T & RunOptions> {
|
||||
return withExcludeOption(yargs)
|
||||
return withVerbose(withExcludeOption(yargs))
|
||||
.option('parallel', {
|
||||
describe: 'Max number of parallel processes [default is 3]',
|
||||
type: 'string',
|
||||
@ -63,11 +63,6 @@ export function withRunOptions<T>(yargs: Argv<T>): Argv<T & RunOptions> {
|
||||
? false
|
||||
: value,
|
||||
})
|
||||
.option('verbose', {
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Prints additional information about the commands (e.g., stack traces)',
|
||||
})
|
||||
.option('nxBail', {
|
||||
describe: 'Stop command execution after the first failed task',
|
||||
type: 'boolean',
|
||||
@ -123,6 +118,20 @@ export function withConfiguration(yargs: Argv) {
|
||||
});
|
||||
}
|
||||
|
||||
export function withVerbose(yargs: Argv) {
|
||||
return yargs
|
||||
.option('verbose', {
|
||||
describe:
|
||||
'Prints additional information about the commands (e.g., stack traces)',
|
||||
type: 'boolean',
|
||||
})
|
||||
.middleware((args) => {
|
||||
if (args.verbose) {
|
||||
process.env.NX_VERBOSE_LOGGING = 'true';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function withBatch(yargs: Argv) {
|
||||
return yargs.options('batch', {
|
||||
type: 'boolean',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user