diff options
author | codecalm <codecalm@gmail.com> | 2020-03-21 22:14:34 +0100 |
---|---|---|
committer | codecalm <codecalm@gmail.com> | 2020-03-21 22:14:34 +0100 |
commit | 92e5bd3b957b3accfe4d3656f6fed1e65412192b (patch) | |
tree | ed8003cf157ffae81f4fd915050a7ee329ce60a2 /gulpfile.js | |
parent | 16 new icons: `alarm`, `arrow-back`, `arrow-forward`, `artboard`, `award`, `b... (diff) | |
download | tabler-icons-92e5bd3b957b3accfe4d3656f6fed1e65412192b.tar.xz |
diff changelog
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 73 |
1 files changed, 66 insertions, 7 deletions
diff --git a/gulpfile.js b/gulpfile.js index 5210a8d..4e01a03 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -201,7 +201,7 @@ gulp.task('optimize', function (cb) { }); }); -gulp.task('prepare-changelog', function(cb) { +gulp.task('changelog-commit', function(cb) { cp.exec('git status', function(err, ret) { let newIcons = [], modifiedIcons = [], renamedIcons = []; @@ -234,6 +234,7 @@ gulp.task('prepare-changelog', function(cb) { }); console.log(str); + console.log(''); } if(modifiedIcons.length > 0) { @@ -249,27 +250,85 @@ gulp.task('prepare-changelog', function(cb) { }); console.log(str); + console.log(''); } if(renamedIcons.length > 0) { - let str = ''; - str += `**Renamed icons: `; + console.log(`**Renamed icons: `); renamedIcons.forEach(function(icon, i){ - str += `\`${icon[0]}\` renamed to \`${icon[1]}\``; + console.log(`- \`${icon[0]}\` renamed to \`${icon[1]}\``); + }); + } + + cb(); + }); +}); + +gulp.task('changelog-diff', function(cb) { + const version = p.version; + cp.exec(`git diff v${version} HEAD --name-status`, function(err, ret) { + + let newIcons = [], modifiedIcons = [], renamedIcons = []; + + ret.replace(/A\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) { + newIcons.push(fileName); + }); + + ret.replace(/M\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) { + modifiedIcons.push(fileName); + }); + + ret.replace(/R[0-9]+\s+src\/_icons\/([a-z1-9-]+)\.svg\s+src\/_icons\/([a-z1-9-]+).svg/g, function (m, fileNameBefore, fileNameAfter) { + renamedIcons.push([fileNameBefore, fileNameAfter]); + }); + + modifiedIcons = modifiedIcons.filter( function( el ) { + return newIcons.indexOf( el ) < 0; + }); + + if(newIcons.length > 0) { + let str = ''; + str += `${newIcons.length} new icons: `; - if((i + 1) <= renamedIcons.length - 1) { + newIcons.forEach(function(icon, i){ + str += `\`${icon}\``; + + if((i + 1) <= newIcons.length - 1) { str += ', ' } }); console.log(str); + console.log(''); } - cb(); - }); + if(modifiedIcons.length > 0) { + let str = ''; + str += `Fixed icons: `; + modifiedIcons.forEach(function(icon, i){ + str += `\`${icon}\``; + if((i + 1) <= modifiedIcons.length - 1) { + str += ', ' + } + }); + + console.log(str); + console.log(''); + } + + if(renamedIcons.length > 0) { + console.log(`**Renamed icons: `); + + renamedIcons.forEach(function(icon, i){ + console.log(`- \`${icon[0]}\` renamed to \`${icon[1]}\``); + }); + } + + cb(); + }); }); gulp.task('build-zip', function() { |