commitizen / commitizen/cz-cli

Running Commitizen on `git commit` with cli script

Đang mở
#714 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
17.5k
Fork
566
Merge trung bình
8 giờ 16 phút
Pull request đã merge (30 ngày)
1

Mô tả

I am trying to combine these two sections from docs:
[Running Commitizen on `git commit`](https://github.com/commitizen/cz-cli#optional-running-commitizen-on-git-commit) and [Commitizen for multi-repo projects](https://github.com/commitizen/cz-cli#commitizen-for-multi-repo-projects).

Repository to reproduce: https://github.com/arvigeus/commit
(configuration is in [packages/git-config](https://github.com/arvigeus/commit/tree/master/packages/git-config), cli is in [packages/git-config/conventional-commit.js](https://github.com/arvigeus/commit/blob/master/packages/git-config/conventional-commit.js), nothing special)

When I add a new file and try to commit it, I get the following error:

```sh
$ git commit
husky > pre-commit (node v10.19.0)
✔ Preparing...
✔ Running tasks...
✔ Applying modifications...
✔ Cleaning up...
husky > prepare-commit-msg (node v10.19.0)
/media/data/Workspace/arvigeus/commit/node_modules/commitizen/node_modules/cz-conventional-changelog/index.js:10
defaultType: process.env.CZ_TYPE || config.defaultType,
^

TypeError: Cannot read property 'defaultType' of undefined
at Object. (/media/data/Workspace/arvigeus/commit/node_modules/commitizen/node_modules/cz-conventional-changelog/index.js:10:46)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at getPrompter (/media/data/Workspace/arvigeus/commit/node_modules/commitizen/dist/commitizen/adapter.js:1391:41)
at gitCz (/media/data/Workspace/arvigeus/commit/node_modules/commitizen/dist/cli/strategies/git-cz.js:62:18)
husky > commit-msg (node v10.19.0)
/media/data/Workspace/arvigeus/commit/node_modules/@commitlint/cli/lib/cli.js:124
throw err;
^

TypeError: Cannot read property 'length' of null
at exports.default (/media/data/Workspace/arvigeus/commit/node_modules/@commitlint/rules/lib/header-max-length.js:10:143)
at results.filter.map.entry (/media/data/Workspace/arvigeus/commit/node_modules/@commitlint/lint/lib/index.js:151:17)
at Array.map ()
at Object. (/media/data/Workspace/arvigeus/commit/node_modules/@commitlint/lint/lib/index.js:131:7)
at process._tickCallback (internal/process/next_tick.js:68:7)
husky > commit-msg hook failed (add --no-verify to bypass)
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.