[@commitlint/prompt] get error use '@commitlint/prompt' with commitizen
See original GitHub issueAs 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)
- First step
- 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 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (3 by maintainers)
Top Results From Across the Web
@commitlint/prompt | Yarn - Package Manager
This is the library and commitizen adapter version of commitlint prompt. A ready-to-use cli version is available at @commitlint/prompt-cli. Learn how to use...
Read more >commitlint - Lint commit messages
commitlint helps your team adhere to a commit convention. By supporting npm-installed configurations it makes sharing of commit conventions easy. Getting ...
Read more >commitizen - npm
Start using commitizen in your project by running `npm i commitizen`. There are 669 other projects in the npm registry using commitizen.
Read more >Enhance your commits with Git hooks! • Delicious Insights
Note: you don't have to work with JavaScript to use npm and husky; ... @commitlint/prompt-cli ), but I prefer git commitizen that lets...
Read more >commitlint - Bountysource
It doesn't catch anything and shows no errors found ... The current implementation of @commitlint/prompt is tied to vorpal .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I opened the issue in
commitizen
repo page as it is more related with their code@escapedcat @a-pavlov-parc i did some digging and there seem to be an issue in commitizen
v11: code was transpiled with babel and async functions where converted to functions with regenerator v12: code is compiled with typescript and there is no need anymore to do this transformation
https://github.com/commitizen/cz-cli/blob/ba7eeb67c4d3347cc2369ff6538d9d97761cedc8/src/commitizen/adapter.js#L150-L153
adapter.prompter
is aasync function
butisFunction
returns falsethis implementation is not correct as it should be
this issue should be reported to commitizen but as “workaround” we could take this
https://github.com/conventional-changelog/commitlint/blob/6a48e44dbc803bf49b1f9253e650ca1184421914/%40commitlint/prompt/src/index.ts#L14-L17
and replace it with