commitizen / commitizen/cz-cli
Issue with entry script version
- Linguagem predominante
- JavaScript
- Estrelas
- 17.5k
- Forks
- 566
- Merge médio
- 8h 16min
- PRs com merge (30d)
- 1
Descrição
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
Guia de contribuição
Direção de pesquisa
Comece por custom-commit/cli.js e compare o layout instalado pelo npm com o layout do npm link mostrado no relatório. Leia commitizen/dist/cli/git-cz.js em torno da chamada de bootstrap e commitizen/dist/common/util.js; depois, reproduza o problema com uma instalação empacotada. Está concluído quando o script de entrada é executado sem o ENOENT e o erro de versão subsequente.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, node.js
- Domínio
- cli
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100