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): allow parallel and output-style on publish target #19242

Merged
merged 2 commits into from
Sep 20, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/generated/cli/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
8 changes: 8 additions & 0 deletions docs/generated/packages/nx/documents/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
33 changes: 30 additions & 3 deletions packages/nx/src/command-line/release/command-object.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -172,7 +173,7 @@ const publishCommand: CommandModule<NxReleaseArgs, PublishOptions> = {
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',
Expand All @@ -182,5 +183,31 @@ const publishCommand: CommandModule<NxReleaseArgs, PublishOptions> = {
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']),
};
}
return args;
}