Skip to content

Commit

Permalink
fix: integrate review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Nov 2, 2021
1 parent b822c33 commit 8ec7866
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
4 changes: 2 additions & 2 deletions @commitlint/prompt/package.json
Expand Up @@ -37,9 +37,9 @@
"node": ">=v12"
},
"devDependencies": {
"@commitlint/config-angular": "^11.0.0",
"@commitlint/types": "^11.0.0",
"@commitlint/utils": "^14.0.0",
"@commitlint/types": "^13.2.0",
"@commitlint/config-angular": "^13.2.0",
"@types/inquirer": "^6.5.0",
"inquirer": "^6.5.2",
"commitizen": "^4.2.4"
Expand Down
16 changes: 4 additions & 12 deletions @commitlint/prompt/src/index.ts
Expand Up @@ -3,16 +3,8 @@ import {input} from './input';

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

/**
* Entry point for commitizen
* @param cz inquirer instance passed by commitizen
* @param commit callback to execute with complete commit message
* @return {void}
*/
export async function prompter(
cz: typeof inquirer,
commit: Commit
): Promise<void> {
const message = await input(cz.prompt);
commit(message);
export function prompter(cz: typeof inquirer, commit: Commit): void {
input(cz.prompt).then((message) => {
commit(message);
});
}
6 changes: 3 additions & 3 deletions @commitlint/prompt/src/inquirer/InputCustomPrompt.ts
@@ -1,10 +1,9 @@
/// <reference path="./inquirer.d.ts" />
import {Interface as ReadlineInterface, Key} from 'readline';

import chalk from 'chalk';
import inquirer from 'inquirer';
import InputPrompt from 'inquirer/lib/prompts/input';
import observe from 'inquirer/lib/utils/events';
import {Interface as ReadlineInterface, Key} from 'readline';
import type {Subscription} from 'rxjs/internal/Subscription';

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

let bottomContent = '';
let message = this.getQuestion();
const length = this.measureInput(this.rl.line);

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

let bottomContent = '';

if (error) {
bottomContent = chalk.red('>> ') + error;
} else if (!answered) {
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Expand Up @@ -1398,17 +1398,17 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@commitlint/config-angular-type-enum@^11.0.0":
version "11.0.0"
resolved "https://registry.npmjs.org/@commitlint/config-angular-type-enum/-/config-angular-type-enum-11.0.0.tgz#7a7f6982e45d3696d72eb343a5d1dc23b2f003e0"
integrity sha512-dSyxdkU36aEgDUWBSiM5lsZ/h2K7uCyKf+A5Sf3+Z5JhcLD9GzTo5W+c8KgwTBdL39dkL7sN+EVgsXNjW99pJg==
"@commitlint/config-angular-type-enum@^13.2.0":
version "13.2.0"
resolved "https://registry.npmjs.org/@commitlint/config-angular-type-enum/-/config-angular-type-enum-13.2.0.tgz#e3f9b8a07118ed8e060b0b1d04a549f74957634d"
integrity sha512-HSP9lzCoHC9+bjJquvByiSUpo0GbAipbjcT6l3Jl6XOzkCjhnUkYcQ2b/O5nXv3mf8Vv/n5k2Sk4nbCYEVpSGQ==

"@commitlint/config-angular@^11.0.0":
version "11.0.0"
resolved "https://registry.npmjs.org/@commitlint/config-angular/-/config-angular-11.0.0.tgz#c1cc1dd902a4b9d2a5c072ff38e3ace9be7138e0"
integrity sha512-H8QSEOmfRsPW0Iehid5fY7NZ2HXmyKC6Q83MLFf9KRnmCcbgJtH+faECtqlvPntayO3CYbA4UenIerOaQ0vOAg==
"@commitlint/config-angular@^13.2.0":
version "13.2.0"
resolved "https://registry.npmjs.org/@commitlint/config-angular/-/config-angular-13.2.0.tgz#78c62551279bdf7ed3a9bf993751f346c42b2944"
integrity sha512-mfytI8ZrPt7kuxjZo0ZfFw0bg1zEa2kI6/prVaYJ0FJgOE8EP1Co9Y4DJZEegohfYFeRcFK3radog7WOr2pzdw==
dependencies:
"@commitlint/config-angular-type-enum" "^11.0.0"
"@commitlint/config-angular-type-enum" "^13.2.0"

"@endemolshinegroup/cosmiconfig-typescript-loader@^3.0.2":
version "3.0.2"
Expand Down

0 comments on commit 8ec7866

Please sign in to comment.