Skip to content

[@commitlint/prompt] get error use '@commitlint/prompt' with commitizen #2486

Closed
@Liaoct

Description

@Liaoct

As title.

Expected Behavior

Current Behavior

i got Could not find prompter method in the provided adapter module: @commitlint/prompt

Affected packages

  • prompt

Possible Solution

Maybe this code as below at commitizen/adapter.js, got a error:

function getPrompter(adapterPath) {
  cov_8emx7ww64.f[7]++;
  // Resolve the adapter path
  let resolvedAdapterPath = (cov_8emx7ww64.s[25]++, resolveAdapterPath(adapterPath)); // Load the adapter

  let adapter = (cov_8emx7ww64.s[26]++, require(resolvedAdapterPath));
  /* istanbul ignore next */

  if (adapter && adapter.prompter && (0, _util.isFunction)(adapter.prompter)) {
    return adapter.prompter;
  } else if (adapter && adapter.default && adapter.default.prompter && (0, _util.isFunction)(adapter.default.prompter)) {
    return adapter.default.prompter;
  } else {
    throw new Error(`Could not find prompter method in the provided adapter module: ${adapterPath}`);
  }
}

Steps to Reproduce (for bugs)

  1. First step
  2. Second step
```js module.exports = { extends: ['@commitlint/config-conventional'] } ```

and package.json

{
  "scripts": {
    "commit": "git-cz"
  },
  "config": {
    "commitizen": {
      "path": "@commitlint/prompt"
    }
  }
}

Context

Your Environment

Executable Version
commitlint --version 12.0.1
git --version 2.25.1
node --version 12.16.1
commitizen --version 4.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions