Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added config changelog.releases.skipEmpty

  • Loading branch information...
commit e2c34845a70ec482dbcf34aad38c5ae4a2661128 1 parent 05c8041
@drewfish authored
Showing with 13 additions and 0 deletions.
  1. +2 −0  Readme.md
  2. +3 −0  crank.json
  3. +8 −0 lib/op-changelog.js
View
2  Readme.md
@@ -106,6 +106,8 @@ updates changelog. {file} defaults to `Changelog.md`
* `regexp`: string
* `replace`: string
* if results in `--CRANK:SKIP--` then version is skipped
+ * `skipEmpty`: boolean
+ * if true and version has no changes (after filtering), then the version is skipped
## template
View
3  crank.json
@@ -17,6 +17,9 @@
"replace": "--CRANK:SKIP--"
}
]
+ },
+ "releases": {
+ "skipEmpty": true
}
}
}
View
8 lib/op-changelog.js
@@ -73,6 +73,7 @@ OPChangelog.prototype.run = function(command) {
currentChangeID,
latestChangeID,
changes,
+ skipEmpty,
latestVersion,
rendered = '';
@@ -80,6 +81,8 @@ OPChangelog.prototype.run = function(command) {
this.base.config.changelog.file = command.args.shift();
}
+ skipEmpty = me.base.config.changelog.releases && me.base.config.changelog.releases.skipEmpty;
+
libasync.series([
// read db
@@ -151,6 +154,11 @@ OPChangelog.prototype.run = function(command) {
changes = me.base.filter(changes,
me.base.config.changelog.changes.filters);
+ if (!changes.length && skipEmpty) {
+ console.log('NOTICE: skipped empty release ' + latestVersion);
+ return;
+ }
+ me.base.config.changelog.releases
changes.forEach(function(change) {
change.date = libdateformat(change.date,
me.base.config.changelog.changes.dateformat);
Please sign in to comment.
Something went wrong with that request. Please try again.