aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gulpfile.js73
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() {