digitalroute / cz-conventional-changelog-for-jira

A commitizen adapter for the angular preset of https://github.com/conventional-changelog/conventional-changelog
MIT License
65 stars 63 forks source link

Conflicts when repo is using vorpal #51

Open stringbeans opened 2 years ago

stringbeans commented 2 years ago

Hi there,

Big fan of this commitzen configuration.

I tried applying it to a new repo I started and noticed that it would fail...

git cz
cz-cli@4.2.4, @digitalroute/cz-conventional-changelog-for-jira@7.0.0

? Select the type of change that you're committing: feat:     A new feature
? Enter JIRA issue (DAZ-12345) (optional): 
? Write a short, imperative tense description of the change: 
  [------------------------------------------------------------------------] 66 chars left
   feat: (node:972436) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'then' of undefined
    at /home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/inquirer/lib/ui/prompt.js:88:32
    at Observable._subscribe (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/observable/defer.js:10:21)
    at Observable._trySubscribe (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/Observable.js:44:25)
    at Observable.subscribe (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/Observable.js:30:22)
    at Object.innerSubscribe (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/innerSubscribe.js:102:23)
    at MergeMapSubscriber._innerSub (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/operators/mergeMap.js:80:50)
    at MergeMapSubscriber._tryNext (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/operators/mergeMap.js:74:14)
    at MergeMapSubscriber._next (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/operators/mergeMap.js:57:18)
    at MergeMapSubscriber.Subscriber.next (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/Subscriber.js:66:18)
    at MergeMapSubscriber.notifyNext (/home/john/.nvm/versions/node/v12.22.3/lib/node_modules/commitizen/node_modules/rxjs/internal/operators/mergeMap.js:93:26)
(node:972436) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:972436) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I noticed that this only started happening after i began using vorpal (https://github.com/dthree/vorpal)

If I remove Vorpal, everything works great.

Here's what my package.json looks like:

{
  ...
  "dependencies": {
    "dotenv": "^10.0.0",
    "knex": "^0.95.14",
    "mongoose": "^6.0.13",
    "mysql2": "^2.3.3",
    "ts-node": "^10.4.0",
    "typescript": "^4.5.2",
    "vorpal": "^1.12.0"
  },
  "devDependencies": {
    "@commitlint/cli": "13.2.1",
    "@commitlint/config-conventional": "13.2.0",
    "@digitalroute/cz-conventional-changelog-for-jira": "6.6.0",
    "@types/knex": "^0.16.1",
    "@types/mongoose": "^5.11.97",
    "@types/vorpal": "^1.12.2",
    "husky": "^7.0.4"
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/@digitalroute/cz-conventional-changelog-for-jira",
      "jiraOptional": true,
      "jiraPrepend": "[",
      "jiraAppend": "]"
    }
  }
}

I'm using: yarn @ 1.22.17 node @ 12.22.3 (also tried with v14.18.1)

juliuscc commented 2 years ago

Hi! Sorry for the late reply.

I have never tried using this tool with a global install of commitizen. Could you try installing commitizen as a developer dependency and then triggering it with an NPM script?