diff --git a/docs/generated/cli/print-affected.md b/docs/generated/cli/print-affected.md index d834298a43a0e..6c33c6bbeab2e 100644 --- a/docs/generated/cli/print-affected.md +++ b/docs/generated/cli/print-affected.md @@ -61,12 +61,6 @@ Type: `string` Base of the current branch (usually main) -### configuration - -Type: `string` - -This is the configuration to use when performing tasks on projects - ### exclude Type: `array` diff --git a/docs/generated/packages/nx.json b/docs/generated/packages/nx.json index 55cb9f58b066e..0b3f8da147254 100644 --- a/docs/generated/packages/nx.json +++ b/docs/generated/packages/nx.json @@ -81,7 +81,7 @@ "name": "print-affected", "id": "print-affected", "file": "generated/cli/print-affected", - "content": "---\ntitle: 'print-affected - CLI command'\ndescription: 'Prints information about the projects and targets affected by changes'\n---\n\n# print-affected\n\nPrints information about the projects and targets affected by changes\n\n## Usage\n\n```terminal\nnx print-affected\n```\n\nInstall `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.\n\n### Examples\n\nPrint information about affected projects and the project graph:\n\n```terminal\n nx print-affected\n```\n\nPrint information about the projects affected by the changes between main and HEAD (e.g,. PR):\n\n```terminal\n nx print-affected --base=main --head=HEAD\n```\n\nPrints information about the affected projects and a list of tasks to test them:\n\n```terminal\n nx print-affected --target=test\n```\n\nPrints the projects property from the print-affected output:\n\n```terminal\n nx print-affected --target=build --select=projects\n```\n\nPrints the tasks.target.project property from the print-affected output:\n\n```terminal\n nx print-affected --target=build --select=tasks.target.project\n```\n\n## Options\n\n### all\n\nType: `boolean`\n\nAll projects\n\n### base\n\nType: `string`\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: `string`\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: `array`\n\nDefault: `[]`\n\nExclude certain projects from being processed\n\n### files\n\nType: `array`\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: `string`\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: `boolean`\n\nShow help\n\n### select\n\nType: `string`\n\nSelect the subset of the returned json document (e.g., --select=projects)\n\n### target\n\nType: `string`\n\nTask to run for affected projects\n\n### type\n\nType: `string`\n\nChoices: [app, lib]\n\nSelect the type of projects to be returned (e.g., --type=app)\n\n### uncommitted\n\nType: `boolean`\n\nUncommitted changes\n\n### untracked\n\nType: `boolean`\n\nUntracked changes\n\n### version\n\nType: `boolean`\n\nShow version number\n" + "content": "---\ntitle: 'print-affected - CLI command'\ndescription: 'Prints information about the projects and targets affected by changes'\n---\n\n# print-affected\n\nPrints information about the projects and targets affected by changes\n\n## Usage\n\n```terminal\nnx print-affected\n```\n\nInstall `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`.\n\n### Examples\n\nPrint information about affected projects and the project graph:\n\n```terminal\n nx print-affected\n```\n\nPrint information about the projects affected by the changes between main and HEAD (e.g,. PR):\n\n```terminal\n nx print-affected --base=main --head=HEAD\n```\n\nPrints information about the affected projects and a list of tasks to test them:\n\n```terminal\n nx print-affected --target=test\n```\n\nPrints the projects property from the print-affected output:\n\n```terminal\n nx print-affected --target=build --select=projects\n```\n\nPrints the tasks.target.project property from the print-affected output:\n\n```terminal\n nx print-affected --target=build --select=tasks.target.project\n```\n\n## Options\n\n### all\n\nType: `boolean`\n\nAll projects\n\n### base\n\nType: `string`\n\nBase of the current branch (usually main)\n\n### exclude\n\nType: `array`\n\nDefault: `[]`\n\nExclude certain projects from being processed\n\n### files\n\nType: `array`\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: `string`\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: `boolean`\n\nShow help\n\n### select\n\nType: `string`\n\nSelect the subset of the returned json document (e.g., --select=projects)\n\n### target\n\nType: `string`\n\nTask to run for affected projects\n\n### type\n\nType: `string`\n\nChoices: [app, lib]\n\nSelect the type of projects to be returned (e.g., --type=app)\n\n### uncommitted\n\nType: `boolean`\n\nUncommitted changes\n\n### untracked\n\nType: `boolean`\n\nUntracked changes\n\n### version\n\nType: `boolean`\n\nShow version number\n" }, { "name": "format:check", diff --git a/packages/nx/bin/init-local.ts b/packages/nx/bin/init-local.ts index f2af46855cf81..b53f2d929a3c0 100644 --- a/packages/nx/bin/init-local.ts +++ b/packages/nx/bin/init-local.ts @@ -68,7 +68,6 @@ function isKnownCommand() { 'affected:dep-graph', 'format', 'workspace-schematic', - 'connect-to-nx-cloud', 'clear-cache', 'help', ]; diff --git a/packages/nx/src/command-line/nx-commands.ts b/packages/nx/src/command-line/nx-commands.ts index 36b450ec35bd9..dafd67d1b6d0c 100644 --- a/packages/nx/src/command-line/nx-commands.ts +++ b/packages/nx/src/command-line/nx-commands.ts @@ -58,9 +58,7 @@ export const commandsObject = yargs describe: 'Run target for multiple listed projects', builder: (yargs) => linkToNxDevAndExamples( - withRunManyOptions( - withOutputStyleOption(withTargetAndConfigurationOption(yargs)) - ), + withRunManyOptions(withOutputStyleOption(withTargetOption(yargs))), 'run-many' ), handler: async (args) => @@ -72,9 +70,7 @@ export const commandsObject = yargs builder: (yargs) => linkToNxDevAndExamples( withAffectedOptions( - withRunOptions( - withOutputStyleOption(withTargetAndConfigurationOption(yargs)) - ) + withRunOptions(withOutputStyleOption(withTargetOption(yargs))) ), 'affected' ), @@ -194,10 +190,7 @@ export const commandsObject = yargs builder: (yargs) => linkToNxDevAndExamples( withAffectedOptions( - withTargetAndConfigurationOption( - withPrintAffectedOptions(yargs), - false - ) + withTargetOption(withPrintAffectedOptions(yargs), false) ), 'print-affected' ), @@ -441,6 +434,12 @@ function withRunOptions(yargs: yargs.Argv): yargs.Argv { describe: 'This is the name of the tasks runner configured in nx.json', type: 'string', }) + .options('configuration', { + describe: + 'This is the configuration to use when performing tasks on projects', + type: 'string', + alias: 'c', + }) .option('prod', { describe: 'Use the production configuration', type: 'boolean', @@ -618,24 +617,14 @@ function withOutputStyleOption( }); } -function withTargetAndConfigurationOption( - yargs: yargs.Argv, - demandOption = true -): yargs.Argv { - return yargs - .option('target', { - describe: 'Task to run for affected projects', - type: 'string', - requiresArg: true, - demandOption, - global: false, - }) - .options('configuration', { - describe: - 'This is the configuration to use when performing tasks on projects', - type: 'string', - alias: 'c', - }); +function withTargetOption(yargs: yargs.Argv, demandOption = true): yargs.Argv { + return yargs.option('target', { + describe: 'Task to run for affected projects', + type: 'string', + requiresArg: true, + demandOption, + global: false, + }); } function withNewOptions(yargs: yargs.Argv) { @@ -694,7 +683,7 @@ function withRunOneOptions(yargs: yargs.Argv) { ); const res = withRunOptions( - withOutputStyleOption(withTargetAndConfigurationOption(yargs, false), [ + withOutputStyleOption(withTargetOption(yargs, false), [ 'dynamic', 'static', 'stream',