Skip to content

Commit 4783f4b

Browse files
LinusUjimthedev
authored andcommitted
feat(commit): print deprecation warning when using provided inquirer (#416)
Adapters should depend directly on inquirer instead of using the one provided by us.
1 parent d0772db commit 4783f4b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/commitizen/commit.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from 'path';
2+
import {deprecate} from 'util';
23

34
import pify from 'pify';
45
import dedent from 'dedent';
@@ -11,7 +12,11 @@ export default commit;
1112

1213
function askUser (inquirer, prompter) {
1314
return new Promise(function (resolve, reject) {
14-
prompter(inquirer, function (arg0, arg1) {
15+
const decoratedInquirer = {
16+
prompt: deprecate(inquirer.prompt, 'Using the supplied copy of inquirer is depreacted, please depend on inquirer directly').bind(inquirer)
17+
}
18+
19+
prompter(decoratedInquirer, function (arg0, arg1) {
1520
// Allow adapters to error out by providing an Error
1621
if (arg0 instanceof Error) {
1722
return reject(arg0);

0 commit comments

Comments
 (0)