leoforfree / cz-customizable

A standalone commit message helper or customizable commitizen adapter for https://github.com/commitizen/cz-cli
MIT License
609 stars 200 forks source link

[Bug] invalid custom scopes #212

Closed linpengteng closed 1 year ago

linpengteng commented 1 year ago

invalid custom scopes when I use inquirer v6.5.2

  // in inquirer
  filterIfRunnable(question) {
    if (
      question.askAnswered !== true &&
      _.get(this.answers, question.name) !== undefined
    ) {
      return empty();
    }

    if (question.when === false) {
      return empty();
    }
   ....

You Need to set askAnswered to true, Because {name: 'scope'} is repeated.

  // cz-customizable questions.js
  {
      type: 'input',
      name: 'scope',
      askAnswered: true, // Add
      message: messages.customScope,
      when(answers) {
        return answers.scope === 'custom';
      },
    }
linpengteng commented 1 year ago

If you need it urgently, You can fix that bug(https://github.com/leoforfree/cz-customizable/pull/214) to yarn pacth-package or use cz-message-helper(https://github.com/linpengteng/cz-message-helper) npm package.