Skip to content

Commit d1bdcc4

Browse files
committed
fix: integrate review feedback
1 parent 523865a commit d1bdcc4

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

@commitlint/prompt/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
},
3838
"devDependencies": {
3939
"@commitlint/utils": "^13.2.0",
40-
"@commitlint/types": "^13.2.0",
4140
"@commitlint/config-angular": "^13.2.0",
4241
"@types/inquirer": "^6.5.0",
4342
"commitizen": "^4.2.4"
4443
},
4544
"dependencies": {
4645
"@commitlint/load": "^13.2.0",
46+
"@commitlint/types": "^13.2.0",
4747
"chalk": "^4.0.0",
4848
"lodash": "^4.17.19",
4949
"inquirer": "^6.5.2"

@commitlint/prompt/src/index.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,8 @@ import {input} from './input';
33

44
type Commit = (input: string) => void;
55

6-
/**
7-
* Entry point for commitizen
8-
* @param cz inquirer instance passed by commitizen
9-
* @param commit callback to execute with complete commit message
10-
* @return {void}
11-
*/
12-
export async function prompter(
13-
cz: typeof inquirer,
14-
commit: Commit
15-
): Promise<void> {
16-
const message = await input(cz.prompt);
17-
commit(message);
6+
export function prompter(cz: typeof inquirer, commit: Commit): void {
7+
input(cz.prompt).then((message) => {
8+
commit(message);
9+
});
1810
}

@commitlint/prompt/src/inquirer/InputCustomPrompt.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
/// <reference path="./inquirer.d.ts" />
2-
import {Interface as ReadlineInterface, Key} from 'readline';
3-
42
import chalk from 'chalk';
53
import inquirer from 'inquirer';
64
import InputPrompt from 'inquirer/lib/prompts/input';
75
import observe from 'inquirer/lib/utils/events';
6+
import {Interface as ReadlineInterface, Key} from 'readline';
87
import type {Subscription} from 'rxjs/internal/Subscription';
98

109
import Answers = inquirer.Answers;
@@ -86,7 +85,6 @@ export default class InputCustomPrompt<
8685
render(error?: string): void {
8786
const answered = this.status === 'answered';
8887

89-
let bottomContent = '';
9088
let message = this.getQuestion();
9189
const length = this.measureInput(this.rl.line);
9290

@@ -96,6 +94,8 @@ export default class InputCustomPrompt<
9694
message += this.opt.transformer(this.rl.line, this.answers, {});
9795
}
9896

97+
let bottomContent = '';
98+
9999
if (error) {
100100
bottomContent = chalk.red('>> ') + error;
101101
} else if (!answered) {

0 commit comments

Comments
 (0)