Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added config changelog.releases.skipEmpty

  • Loading branch information...
commit e2c34845a70ec482dbcf34aad38c5ae4a2661128 1 parent 05c8041
Drew Folta authored

Showing 3 changed files with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. +2 0  Readme.md
  2. +3 0  crank.json
  3. +8 0 lib/op-changelog.js
2  Readme.md
Source Rendered
@@ -106,6 +106,8 @@ updates changelog. {file} defaults to `Changelog.md`
106 106 * `regexp`: string
107 107 * `replace`: string
108 108 * if results in `--CRANK:SKIP--` then version is skipped
  109 + * `skipEmpty`: boolean
  110 + * if true and version has no changes (after filtering), then the version is skipped
109 111
110 112
111 113 ## template
3  crank.json
@@ -17,6 +17,9 @@
17 17 "replace": "--CRANK:SKIP--"
18 18 }
19 19 ]
  20 + },
  21 + "releases": {
  22 + "skipEmpty": true
20 23 }
21 24 }
22 25 }
8 lib/op-changelog.js
@@ -73,6 +73,7 @@ OPChangelog.prototype.run = function(command) {
73 73 currentChangeID,
74 74 latestChangeID,
75 75 changes,
  76 + skipEmpty,
76 77 latestVersion,
77 78 rendered = '';
78 79
@@ -80,6 +81,8 @@ OPChangelog.prototype.run = function(command) {
80 81 this.base.config.changelog.file = command.args.shift();
81 82 }
82 83
  84 + skipEmpty = me.base.config.changelog.releases && me.base.config.changelog.releases.skipEmpty;
  85 +
83 86 libasync.series([
84 87
85 88 // read db
@@ -151,6 +154,11 @@ OPChangelog.prototype.run = function(command) {
151 154
152 155 changes = me.base.filter(changes,
153 156 me.base.config.changelog.changes.filters);
  157 + if (!changes.length && skipEmpty) {
  158 + console.log('NOTICE: skipped empty release ' + latestVersion);
  159 + return;
  160 + }
  161 + me.base.config.changelog.releases
154 162 changes.forEach(function(change) {
155 163 change.date = libdateformat(change.date,
156 164 me.base.config.changelog.changes.dateformat);

0 comments on commit e2c3484

Please sign in to comment.
Something went wrong with that request. Please try again.