包详细信息

nf-conventional-changelog

jameswomack86BSD1.0.0

Generate a changelog from git metadata, using the Netflix DSC commit conventions

changelog, conventional, generate, release

自述文件

NPM version Build Status Dependency Status Coverage Status

Generate a changelog from git metadata, using the AngularJS commit conventions

Install

$ npm install conventional-changelog

Adapted from code originally written by @vojtajina and @btford in grunt-conventional-changelog.

Example output

Roadmap

  • Make it return a stream
  • Add a proper command line interface
  • Add configurable subjects & sections
  • Split up this repo into smaller modules #22

Documentation

Simple usage:

require('conventional-changelog')({
  repository: 'https://github.com/joyent/node',
  version: require('./package.json').version
}, function(err, log) {
  console.log('Here is your changelog!', log);
});

changelog(options, callback)

By default, calls the callback with a string containing a changelog from the previous tag to HEAD, using pkg.version, prepended to existing CHANGELOG.md (if it exists).

callback is the second parameter, and takes two parameters: (err, log). log is a string containing the newly generated changelog, and err is either an error or null.

options is the first parameter, an object. The following fields are available:

The Most Important Options
  • version {string} - The version to be written to the changelog. For example, {version: "1.0.1"}. Defaults to the version found in package.json. See pkg to configure the path of package.json.

  • subtitle {string} - A string to display after the version title in the changelog. For example, it will show '## 1.0.0 "Super Version"' if codename '"Super Version"' is given. By default, it's blank.

  • repository {string} - If this is provided, allows issues and commit hashes to be linked to the actual commit. Usually used with github repositories. For example, {repository: 'http://github.com/joyent/node'}. Defaults to "normalized" repository.url found in package.json. See pkg to configure the path of package.json.

  • pkg {string} - The path of package.json. Defaults to ./package.json.

  • from {string} - Which commit the changelog should start at. By default, uses previous tag, or if no previous tag the first commit.

  • to {string} - Which commit the changelog should end at. By default, uses HEAD.

  • file {string} - Which file to read the current changelog from and prepend the new changelog's contents to. By default, uses 'CHANGELOG.md'.

The "I really want to get crazy" Options
  • versionText {function(version, subtitle)} - What to use for the title of a major version in the changelog. Defaults to '## ' + version + ' ' + subtitle.

  • patchVersionText {function(version, subtitle)} - What to use for the title of a patch version in the changelog. Defaults to '### ' + version + ' ' + subtitle.

  • commitLink {function(commitHash)} - If repository is provided, this function will be used to link to commits. By default, returns a github commit link based on options.repository: opts.repository + '/commit/' + hash.

  • issueLink {function(issueId)} - If repository is provided, this function will be used to link to issues. By default, returns a github issue link based on options.repository: opts.repository + '/issues/' + id.

  • log {function()} - What logging function to use. For example, {log: grunt.log.ok}. By default, uses console.log.

  • warn {function()} - What warn function to use. For example, {warn: grunt.log.writeln}. By default, uses console.warn.

License

BSD

更新日志

1.0.0 (2015-06-05)

Bug Fixes

  • changelog: Generated anchors now operable (8f5f908c)

0.0.17 (2015-04-03)

Bump deps

0.0.16 (2015-03-19)

Bug Fixes

  • git: generate the correct cmd of git log when there is no tags (dcd7551f, closes #47, #48)

0.0.15 (2015-03-19)

Bug Fixes

  • log: correct out put for options.from and options.to (31ddb112, closes #47)

0.0.14 (2015-03-14)

Bug Fixes

  • writeLog: fix require statement for Writer (a478f806)

0.0.13 (2015-03-13)

Bug Fixes

  • first commit: add first commit to changelog (386cd404)
  • git: use --abbrev=0 to only get tag from same branch (69cfb5c6)
  • header: fix no <a> if options.repository is provided (7cb5cb56, closes #26)
  • pkg: handle the situation where package.json cannot be found (518bc56e)
  • version: default version is read from package.json properly (f684b9be)

Features

  • defaults: version and repository are read from package.json (cb1feb7d, closes #38)

0.0.11 "reorder" (2014-05-28)

Features

  • changelog: add versionText, patchVersionText options (9d8e0548)

Breaking Changes

  • Removed versionLink and patchVersionLink options, and went back to the default title output from 0.0.9.

If you wish to have a link to your version, simply customize the versionText and patchVersionText options.

(9d8e0548)

0.0.10 "revise" (2014-05-28)

Bug Fixes

  • changelog: put commit range into quotes so it can fetch commits with special characters (76e2f185, closes #10)

Features

  • changelog: add support for scope with spaces (b5e43b75, closes #9)
  • git: allow period-separated closing and lowercase closing (6835af55)
  • writer: add tag hyperlink support (9640cc27)

0.0.9 "change" (2014-05-06)

Bug Fixes

  • changelog: make sure breaking changes are separated by two newlines (85152160)

Features

  • changelog: also add Resolves #xx to closes section (06ff3ea9)

0.0.8 "refine" (2014-04-10)

Features

  • changelog: change options.codename to options.subtitle (a00fea52)

0.0.7 "delta" (2014-04-10)

Features

  • changelog: add options.codename (01f40cb6)

0.0.6 (2014-01-23)

Bug Fixes

0.0.5 (2014-01-23)

Miscellaneous

  • More specific errors given through done callback
  • Improved logging

0.0.4 (2014-01-04)

Bug Fixes

0.0.2 (2014-01-04)

Features