1
0
mirror of https://github.com/tabler/tabler-icons.git synced 2025-08-01 11:50:25 +02:00

diff changelog

This commit is contained in:
codecalm
2020-03-21 22:14:34 +01:00
parent 0908f417fe
commit 92e5bd3b95

View File

@@ -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]}\``);
});
}
if((i + 1) <= renamedIcons.length - 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: `;
newIcons.forEach(function(icon, i){
str += `\`${icon}\``;
if((i + 1) <= newIcons.length - 1) {
str += ', '
}
});
console.log(str);
console.log('');
}
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() {