fix(release): allow string array for commitArgs and tagArgs (#27797)

This commit is contained in:
Austin Fahsl 2024-09-17 04:19:33 -06:00 committed by GitHub
parent 0a8202aee1
commit 786537efa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 13 deletions

View File

@ -634,7 +634,7 @@
"description": "Custom git commit message to use when committing the changes made by this command"
},
"commitArgs": {
"type": "string",
"type": ["string", "array"],
"description": "Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes"
},
"stageChanges": {
@ -650,7 +650,7 @@
"description": "Custom git tag message to use when tagging the changes made by this command. This defaults to be the same value as the tag itself."
},
"tagArgs": {
"type": "string",
"type": ["string", "array"],
"description": "Additional arguments to pass to the `git tag` command invoked behind the scenes"
}
}

View File

@ -30,10 +30,10 @@ interface GitCommitAndTagOptions {
stageChanges?: boolean;
gitCommit?: boolean;
gitCommitMessage?: string;
gitCommitArgs?: string;
gitCommitArgs?: string | string[];
gitTag?: boolean;
gitTagMessage?: string;
gitTagArgs?: string;
gitTagArgs?: string | string[];
}
export type VersionOptions = NxReleaseArgs &

View File

@ -251,7 +251,7 @@ export async function gitCommit({
logFn,
}: {
messages: string[];
additionalArgs?: string;
additionalArgs?: string | string[];
dryRun?: boolean;
verbose?: boolean;
logFn?: (message: string) => void;
@ -263,7 +263,11 @@ export async function gitCommit({
commandArgs.push('--message', message);
}
if (additionalArgs) {
commandArgs.push(...additionalArgs.split(' '));
if (Array.isArray(additionalArgs)) {
commandArgs.push(...additionalArgs);
} else {
commandArgs.push(...additionalArgs.split(' '));
}
}
if (verbose) {
@ -305,7 +309,7 @@ export async function gitTag({
}: {
tag: string;
message?: string;
additionalArgs?: string;
additionalArgs?: string | string[];
dryRun?: boolean;
verbose?: boolean;
logFn?: (message: string) => void;
@ -321,7 +325,11 @@ export async function gitTag({
message || tag,
];
if (additionalArgs) {
commandArgs.push(...additionalArgs.split(' '));
if (Array.isArray(additionalArgs)) {
commandArgs.push(...additionalArgs);
} else {
commandArgs.push(...additionalArgs.split(' '));
}
}
if (verbose) {

View File

@ -88,7 +88,7 @@ export async function commitChanges({
isDryRun?: boolean;
isVerbose?: boolean;
gitCommitMessages?: string[];
gitCommitArgs?: string;
gitCommitArgs?: string | string[];
}) {
if (!changedFiles?.length && !deletedFiles?.length) {
throw new Error('Error: No changed files to commit');

View File

@ -123,9 +123,9 @@ export interface NxReleaseGitConfiguration {
*/
commitMessage?: string;
/**
* Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes
* Additional arguments (added after the --message argument, which may or may not be customized with --git-commit-message) to pass to the `git commit` command invoked behind the scenes. May be a string or array of strings.
*/
commitArgs?: string;
commitArgs?: string | string[];
/**
* Whether or not to stage the changes made by this command. Always treated as true if commit is true.
*/
@ -139,9 +139,9 @@ export interface NxReleaseGitConfiguration {
*/
tagMessage?: string;
/**
* Additional arguments to pass to the `git tag` command invoked behind the scenes
* Additional arguments to pass to the `git tag` command invoked behind the scenes. . May be a string or array of strings.
*/
tagArgs?: string;
tagArgs?: string | string[];
}
export interface NxReleaseConventionalCommitsConfiguration {