commitizen / commitizen/cz-cli
Issue with entry script version
- 主要言語
- JavaScript
- スター
- 17.5k
- フォーク
- 566
- 平均マージ
- 8時間 16分
- マージ済み PR(30日)
- 1
説明
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
コントリビューションガイド
調査の方向性
custom-commit/cli.js から始め、npm インストール時のレイアウトと、レポートに示されている npm link のレイアウトを比較します。bootstrap 呼び出しの周辺にある commitizen/dist/cli/git-cz.js と commitizen/dist/common/util.js を読み、その後パッケージ化したインストールで再現します。エントリースクリプトが ENOENT とそれに続くバージョンエラーなしで実行されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100