conventional-changelog 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,9 +60,9 @@ By default, calls the callback with a string containing a changelog from the pre
60
60
 
61
61
  ##### The "I really want to get crazy" Options
62
62
 
63
- * `versionLink` `{function(version, subtitle)}` - If repository is provided, this function will be used to link to major and minor versions. By default, returns a github version link based on options.repository: `opts.repository + '/releases/tag/' + version`
63
+ * `versionText` `{function(version, subtitle)}` - What to use for the title of a major version in the changelog. Defaults to `'## ' + version + ' ' + subtitle`.
64
64
 
65
- * `patchVersionLink` `{function(version, subtitle)}` - If repository is provided, this function will be used to link to patch versions. By default, returns a github version link based on options.repository: `opts.repository + '/releases/tag/' + version`
65
+ * `patchVersionText` `{function(version, subtitle)}` - What to use for the title of a patch version in the changelog. Defaults to `'### ' + version + ' ' + subtitle`.
66
66
 
67
67
  * `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`
68
68
 
package/lib/writer.js CHANGED
@@ -2,10 +2,8 @@ var es = require('event-stream');
2
2
  var util = require('util');
3
3
  var extend = require('lodash.assign');
4
4
 
5
- var LINK_VERSION = '[## %s%s](%s/releases/tag/%s)';
6
- var VERSION = '## %s %s';
7
- var LINK_PATCH_VERSION = '[### %s%s](%s/releases/tag/%s)';
8
- var PATCH_VERSION = '### %s %s';
5
+ var VERSION = '## %s%s';
6
+ var PATCH_VERSION = '### %s%s';
9
7
  var LINK_ISSUE = '[#%s](%s/issues/%s)';
10
8
  var ISSUE = '(#%s)';
11
9
  var LINK_COMMIT = '[%s](%s/commit/%s)';
@@ -16,17 +14,13 @@ module.exports = {
16
14
  Writer: Writer
17
15
  };
18
16
 
19
- function getVersionLink (repository, version, subtitle) {
17
+ function getVersion (version, subtitle) {
20
18
  subtitle = subtitle ? ' ' + subtitle : '';
21
- return repository ?
22
- util.format(LINK_VERSION, version, subtitle, repository, version) :
23
- util.format(VERSION, version, version, subtitle);
19
+ return util.format(VERSION, version, subtitle);
24
20
  }
25
- function getPatchVersionLink (repository, version, subtitle) {
21
+ function getPatchVersion (version, subtitle) {
26
22
  subtitle = subtitle ? ' ' + subtitle : '';
27
- return repository ?
28
- util.format(LINK_PATCH_VERSION, version, subtitle, repository, version) :
29
- util.format(PATCH_VERSION, version, version, subtitle);
23
+ return util.format(PATCH_VERSION, version, subtitle);
30
24
  }
31
25
  function getIssueLink(repository, issue) {
32
26
  return repository ?
@@ -41,12 +35,6 @@ function getCommitLink(repository, hash) {
41
35
  }
42
36
 
43
37
  function writeLog(commits, options, done) {
44
- options = extend({
45
- versionLink: getVersionLink.bind(null, options.repository),
46
- patchVersionLink: getPatchVersionLink.bind(null, options.repository),
47
- issueLink: getIssueLink.bind(null, options.repository),
48
- commitLink: getCommitLink.bind(null, options.repository)
49
- }, options || {});
50
38
 
51
39
  var log = '';
52
40
  var stream = es.through(function(data) {
@@ -95,8 +83,8 @@ var EMPTY_COMPONENT = '$$';
95
83
 
96
84
  function Writer(stream, options) {
97
85
  options = extend({
98
- versionLink: getVersionLink.bind(null, options.repository),
99
- patchVersionLink: getPatchVersionLink.bind(null, options.repository),
86
+ versionText: getVersion,
87
+ patchVersionText: getPatchVersion,
100
88
  issueLink: getIssueLink.bind(null, options.repository),
101
89
  commitLink: getCommitLink.bind(null, options.repository)
102
90
  }, options || {});
@@ -104,8 +92,8 @@ function Writer(stream, options) {
104
92
  this.header = function(version) {
105
93
  var subtitle = options.subtitle || '';
106
94
  var versionText = version.split('.')[2] === '0' ?
107
- options.versionLink(version, subtitle) :
108
- options.patchVersionLink(version, subtitle);
95
+ options.versionText(version, subtitle) :
96
+ options.patchVersionText(version, subtitle);
109
97
 
110
98
  if (options.repository) {
111
99
  stream.write(util.format(LINK_HEADER_TPL, versionText, currentDate()));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "conventional-changelog",
3
- "codename": "change",
4
- "version": "0.0.10",
3
+ "codename": "reorder",
4
+ "version": "0.0.11",
5
5
  "description": "Generate a markdown changelog from git commit metadata",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -33,12 +33,12 @@ describe("Writer", function() {
33
33
  it('minor version', function() {
34
34
  var writer = setup();
35
35
  writer.header('0.1.0');
36
- expect(log).to.contain('[## 0.1.0 subby](github.com/user/repo/releases/tag/0.1.0)');
36
+ expect(log).to.contain('## 0.1.0 subby');
37
37
  });
38
38
  it('patch version', function() {
39
39
  var writer = setup();
40
40
  writer.header('0.0.3');
41
- expect(log).to.contain('[### 0.0.3 subby](github.com/user/repo/releases/tag/0.0.3)');
41
+ expect(log).to.contain('### 0.0.3 subby');
42
42
  });
43
43
  });
44
44