From f4bc692e64af859936379c70dd5308d5cc5e9714 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 20 Sep 2023 00:45:50 +0400 Subject: [PATCH 1/2] fix(core): allow parallel and output-style on publish target --- docs/generated/cli/release.md | 8 +++++ .../packages/nx/documents/release.md | 8 +++++ .../command-line/release/command-object.ts | 32 +++++++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/docs/generated/cli/release.md b/docs/generated/cli/release.md index 3b7471d9cbd3b..0bf995fc09d11 100644 --- a/docs/generated/cli/release.md +++ b/docs/generated/cli/release.md @@ -199,6 +199,14 @@ Default: `false` Ignore cycles in the task graph +##### output-style + +Type: `string` + +Choices: [dynamic, static, stream, stream-without-prefixes] + +Defines how Nx emits outputs tasks logs + ##### parallel Type: `string` diff --git a/docs/generated/packages/nx/documents/release.md b/docs/generated/packages/nx/documents/release.md index 3b7471d9cbd3b..0bf995fc09d11 100644 --- a/docs/generated/packages/nx/documents/release.md +++ b/docs/generated/packages/nx/documents/release.md @@ -199,6 +199,14 @@ Default: `false` Ignore cycles in the task graph +##### output-style + +Type: `string` + +Choices: [dynamic, static, stream, stream-without-prefixes] + +Defines how Nx emits outputs tasks logs + ##### parallel Type: `string` diff --git a/packages/nx/src/command-line/release/command-object.ts b/packages/nx/src/command-line/release/command-object.ts index 309c8b54e2b8f..87867f4080935 100644 --- a/packages/nx/src/command-line/release/command-object.ts +++ b/packages/nx/src/command-line/release/command-object.ts @@ -1,8 +1,9 @@ import { CommandModule, showHelp } from 'yargs'; import { readNxJson } from '../../project-graph/file-utils'; import { - parseCSV, RunManyOptions, + parseCSV, + withOutputStyleOption, withOverrides, withRunManyOptions, } from '../yargs-utils/shared-options'; @@ -172,7 +173,7 @@ const publishCommand: CommandModule = { aliases: ['p'], describe: 'Publish a versioned project to a registry', builder: (yargs) => - withRunManyOptions(yargs) + withRunManyOptions(withOutputStyleOption(yargs)) .option('registry', { type: 'string', description: 'The registry to publish to', @@ -182,5 +183,30 @@ const publishCommand: CommandModule = { description: 'The distribution tag to apply to the published package', }), handler: (args) => - import('./publish').then((m) => m.publishHandler(withOverrides(args, 2))), + import('./publish').then((m) => + m.publishHandler(coerceParallelOption(withOverrides(args, 2))) + ), }; + +function coerceParallelOption(args: any) { + if (args['parallel'] === 'false' || args['parallel'] === false) { + return { + ...args, + parallel: 1, + }; + } else if ( + args['parallel'] === 'true' || + args['parallel'] === true || + args['parallel'] === '' + ) { + return { + ...args, + parallel: Number(args['maxParallel'] || args['max-parallel'] || 3), + }; + } else if (args['parallel'] !== undefined) { + return { + ...args, + parallel: Number(args['parallel']), + }; + } +} From c557cad6fe6d468e596309efa0f564ba0e5799ef Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 20 Sep 2023 12:41:37 +0400 Subject: [PATCH 2/2] fix(core): missing args --- packages/nx/src/command-line/release/command-object.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nx/src/command-line/release/command-object.ts b/packages/nx/src/command-line/release/command-object.ts index 87867f4080935..9ffe806391fa3 100644 --- a/packages/nx/src/command-line/release/command-object.ts +++ b/packages/nx/src/command-line/release/command-object.ts @@ -209,4 +209,5 @@ function coerceParallelOption(args: any) { parallel: Number(args['parallel']), }; } + return args; }