commitizen / commitizen/cz-cli

Issue with entry script version

Đang mở
#424 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
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ả

Following the guide in: https://github.com/commitizen/cz-cli#1-create-your-own-entry-point-script

It works when using `npm link` but when I install from npm it throws the following error.
It looks like its trying to read a package.json that is nested under my custom-commit package but commitizen package is directly under node_modules not my package.

```
{ Error: ENOENT: no such file or directory, open '/Users/test123/repos/test/npm/node_modules/custom-commit/node_modules/commitizen/package.json'
at Object.fs.openSync (fs.js:558:18)
at Object.fs.readFileSync (fs.js:468:33)
at getParsedJsonFromFile (/Users/test123/repos/test/npm/node_modules/commitizen/dist/common/util.js:43:44)
at getParsedPackageJsonFromPath (/Users/test123/repos/test/npm/node_modules/commitizen/dist/common/util.js:54:10)
at /Users/test123/repos/test/npm/node_modules/commitizen/dist/cli/strategies/git-cz.js:92:65
at /Users/test123/repos/test/npm/node_modules/commitizen/dist/commitizen/staging.js:25:5
at ChildProcess.exithandler (child_process.js:202:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/test123/repos/test/npm/node_modules/custom-commit/node_modules/commitizen/package.json' }
/Users/test123/repos/test/npm/node_modules/commitizen/dist/cli/strategies/git-cz.js:93
console.log('cz-cli@' + cliPackageJson.version + ', ' + adapterPackageJson.name + '@' + adapterPackageJson.version + '\n');
^

TypeError: Cannot read property 'version' of undefined
at /Users/test123/repos/test/npm/node_modules/commitizen/dist/cli/strategies/git-cz.js:93:43
at /Users/test123/repos/test/npm/node_modules/commitizen/dist/commitizen/staging.js:25:5
at ChildProcess.exithandler (child_process.js:202:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
```

custom-commmit/cli.js
```
#!/usr/bin/env node

const path = require('path');
const bootstrap = require('commitizen/dist/cli/git-cz').bootstrap;

bootstrap({
cliPath: path.join(__dirname, 'node_modules/commitizen'),
config: {
path: '@mycompany/cz-custom-changelog'
}
});

```

@mycompany/cz-custom-changelog is a dependency of custom-commit

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.