style(commit.ts): format code with prettier
refactor(commit.ts): add types to commit function parameters fix(git.ts): handle empty string returned from getStagedFiles function refactor(mergeStrings.ts): remove unnecessary blank line and add missing semicolon
This commit is contained in:
+14
-5
@@ -60,7 +60,12 @@ ${chalk.grey('——————————————————')}`
|
||||
});
|
||||
|
||||
if (isCommitConfirmedByUser && !isCancel(isCommitConfirmedByUser)) {
|
||||
const { stdout } = await execa('git', ['commit', '-m', commitMessage, ...extraArgs]);
|
||||
const { stdout } = await execa('git', [
|
||||
'commit',
|
||||
'-m',
|
||||
commitMessage,
|
||||
...extraArgs
|
||||
]);
|
||||
|
||||
outro(`${chalk.green('✔')} successfully committed`);
|
||||
|
||||
@@ -83,8 +88,10 @@ ${chalk.grey('——————————————————')}`
|
||||
} else outro(`${chalk.gray('✖')} process cancelled`);
|
||||
};
|
||||
|
||||
|
||||
export async function commit(extraArgs=[], isStageAllFlag = false) {
|
||||
export async function commit(
|
||||
extraArgs: string[] = [],
|
||||
isStageAllFlag: Boolean = false
|
||||
) {
|
||||
if (isStageAllFlag) {
|
||||
const changedFiles = await getChangedFiles();
|
||||
|
||||
@@ -123,7 +130,6 @@ export async function commit(extraArgs=[], isStageAllFlag = false) {
|
||||
isStageAllAndCommitConfirmedByUser &&
|
||||
!isCancel(isStageAllAndCommitConfirmedByUser)
|
||||
) {
|
||||
|
||||
await commit(extraArgs, true);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -153,7 +159,10 @@ export async function commit(extraArgs=[], isStageAllFlag = false) {
|
||||
);
|
||||
|
||||
const [, generateCommitError] = await trytm(
|
||||
generateCommitMessageFromGitDiff(await getDiff({ files: stagedFiles }), extraArgs)
|
||||
generateCommitMessageFromGitDiff(
|
||||
await getDiff({ files: stagedFiles }),
|
||||
extraArgs
|
||||
)
|
||||
);
|
||||
|
||||
if (generateCommitError) {
|
||||
|
||||
Reference in New Issue
Block a user