无法使用常规变更日志生成变更日志

Can't generate changelog with conventional-changelog

我正在尝试为我正在从事的新项目设置新的工作流程。我真的很想使用 conventional-changelog,但目前我无法让它工作。

首先,我什至不能使cli 工具工作。我确实在全球范围内安装了,但每次我都在尝试 运行: conventional-changelog --help 在 shell 上,它说:conventional-changelog: command not found,但是如果我做 npm ls -g -depth=0,我可以看到列出的 conventional-changelog@0.0.17 包。

我遇到的另一个问题是我无法创建更新日志。

我已经有一些 angular 格式的提交(实际上只有一个)。是这样的:

feat(): onUrlChange event (popstate/hashchange/polling)

(这是从文档中复制的示例,用于调试)

我在根目录下也有一个 CHANGELOG.md 空文件,我创建了一个 test.js,内容如下:

var conventionalChangelog = require('conventional-changelog');

conventionalChangelog({
  preset: 'angular'
})
  .pipe(process.stdout);

每当 运行 节点测试我得到:

conventionalChangelog().pipe(process.stdout);
                       ^
TypeError: Cannot read property 'pipe' of undefined
    at Object.<anonymous> (/Users/antonio/Projects/cabesa/test.js:45:24)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

有什么建议可以让我找到合适的位置吗?

我的最终目标是创建一些 gulp 自动管理所有流程的任务:部署、文档、测试等...但我被困在这里。

谢谢

问题是他们的文档只反映了 master 分支中当前代码的状态。最后一次发布是在 4 月,当时 the exported function did not return anything (hence the undefined error you're seeing). You may try installing from the master branch (npm install https://github.com/ajoslin/conventional-changelog/tarball/master), or use the documentation that was available at the time of the last release (v0.0.17 截至撰写本文时)。