cz-cli icon indicating copy to clipboard operation
cz-cli copied to clipboard

Support yarn v2

Open fifn2 opened this issue 5 years ago • 2 comments

Yarn v2 has a new directory structure that doesn't involve modules. eslint-plugin-import was able to solve an issue like this quite easily by using createRequireFromPath instead of require.resolve.

fifn2 avatar Feb 05 '20 02:02 fifn2

git-cz cli works for me in yarn-2.0.0-rc.36. below is my project setup.

Install

$ yarn add commitizen cz-lerna-changelog

package.json

{
  "config": {
    "commitizen": {
      "path": "cz-lerna-changelog"
    }
  }
}

Script

$ yarn git-cz

tonyfromundefined avatar Jul 10 '20 09:07 tonyfromundefined

I think the docs should probably be updated to reflect this, but here's my current config with the newest version of husky:

package.json

{
  "config": {
    "commitizen": {
      "path": "cz-<your flavor>" // Notice the lack of ./node_modules
    }
  }
}

.husky/prepare-commit-msg

#!/bin/bash
exec < /dev/tty && yarn cz --hook || true # notice the lack of node_modules/.bin and instead using yarn

I would argue that if this is added to the docs, this issue should be closed.

kevin-lindsay-1 avatar Apr 03 '21 21:04 kevin-lindsay-1