Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@commitlint/prompt does not use commitizen inquirer #402

Closed
1 of 4 tasks
EECOLOR opened this issue Jul 30, 2018 · 3 comments · Fixed by #2697
Closed
1 of 4 tasks

@commitlint/prompt does not use commitizen inquirer #402

EECOLOR opened this issue Jul 30, 2018 · 3 comments · Fixed by #2697

Comments

@EECOLOR
Copy link

EECOLOR commented Jul 30, 2018

Note that the current behavior is most definitely 'expected behavior' from the perspective of the commitlint library authors.

Expected Behavior

I was expecting this module, which is marketed as an adapter for commitizen, to actually use it's main component: the commitizen inquirer.

Current Behavior

@commitlint/prompt/src/index.js#L11

export const prompter = async (_, commit) => {
	const message = await input(vorpal);
	commit(message);
};

It is ignored and another mechanism is used.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

If prompt is meant as an alternative way to help fill the template (as suggested by prompt-cli) the commitizen adapter could be another package. You could still keep the original prompt compatible with commitizen for backwards compatibility.

From a naive perspective (this was my first experience with the whole ecosystem) I was expecting the adapter to feed the inquirer based on the linting rules I supplied. Thinking this would prevent me from manually keeping the linting rules and template inquirer in sync.

As I said, it could very well be that the prompt package has a different intention. I am willing to look into making a pull request, but only if the maintainers would agree with and see value in such a package (@commitlint/commitizen).

Context

I first tried prompt-cli and I did not enjoy the experience (which I think is purely taste, so no argument there). I then tried commitzen, which I liked better. Then I thought, it would be great if the template questions were in sync with the rules that I was enforcing. To my surpise (positive) there was an adapter which (in my naive mind) was suited for this situation. This however provided a new surprise (negative) as the adapter pushed me back to the prompt-cli experience.

@escapedcat
Copy link
Member

@marionebl
Copy link
Contributor

We should tackle this via two things:

  1. Improve docs as mentioned via Difference prompt and prompt-cli #297
  2. Create a "true" commitizen adapter that uses Inquirer UI.

@byCedric
Copy link
Member

I created a custom commitizen adapter to use internally at Peakfijn. It's loading the commitlint configuration and embeds both the commit types as well as the commit scopes into the inquirer. Finally, it double checks if everything matches the expected outcome by running commitlint against the built message, before actually committing.

Is this how you'd would expect the commitlint commitizen adapter to work @EECOLOR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment