opencommit
opencommit copied to clipboard
🐛Fix: prompt-module/@commitlint
Current Issue
- The
OCO_PROMPT_MODULE=@commitlintfunctionality is currently not working as expected. The following steps reproduce the issue:- Run
npm i @commitlint/cli - Create
commitlint.config.js - Set
OCO_PROMPT_MODULE=@commitlint - run
oco commitlint force - => An error occurs
- Run
Identified Problems
- There's a bug in
src/modules/commitlint/utils.ts#getJSONBlockconsistencyis not defined (a misspelling ofinput).
- The method
src/modules/commitlint/pwd-commitlint.ts#getCommitLintPWDConfigonly supports the CJS version of the@commitlint/loadpackage.- This method calls the
@commitlint/loadpackage usingrequire. However, commitlint v19 and onwards only support pure ESM.
- This method calls the
Proposed Changes
- Fix the
OCO_PROMPT_MODULE=@commitlintfunctionality- by correcting the bug in
src/modules/commitlint/utils.ts#getJSONBlock.
- by correcting the bug in
- Add support for the ESM version of @commitlint.
- This change will ensure compatibility with both CJS and ESM versions of @commitlint.
- Currently, the minimum supported version is v9 (as CJS) and the maximum supported version is v19 (as ESM, latest).
- Add end-to-end tests related to commitlint to ensure the functionality works as expected.
Checklist
- [x] Manual Setup
git initnpm init- Setup commitlint
- for v19
- install commitlint(
npm install --save-dev @commitlint/{cli,config-conventional}@19.x) - create commitlint config (as esm)
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
- set
type: modulein package.json
- install commitlint(
- for v18
- install commitlint (
npm install --save-dev @commitlint/{cli,config-conventional}@18.x) - create commitlint config (as cjs)
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
- install commitlint (
- for v19
- Run
oco config set OCO_PROMPT_MODULE=@commitlint - Run
oco commitlint force - Run
oco - Edit
.opencommit-commitlintconfig - Run
ocoagain
hi man, please calm down! haha <3
let me know when i can review and merge it
@di-sukharev Hello, The PR is ready and I wanted to let you know. Please review it.