aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gulpfile.js73
-rw-r--r--package.json8
2 files changed, 54 insertions, 27 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 9afd7e0..3de333d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -217,10 +217,7 @@ gulp.task('icons-sprite', function (cb) {
});
gulp.task('icons-preview', function (cb) {
-
- glob("_site/icons/*.svg", {}, function (er, files) {
- console.log('files', files);
-
+ glob("icons/*.svg", {}, function (er, files) {
generateIconsPreview(files, '.github/icons.svg', cb);
});
});
@@ -311,38 +308,68 @@ gulp.task('changelog-commit', function (cb) {
});
});
-gulp.task('changelog-diff', function (cb) {
+gulp.task('changelog', function (cb) {
const version = argv['latest-tag'] || `v${p.version}`;
-
- cp.exec(`git diff ${version} HEAD --name-status`, function (err, ret) {
- let newIcons = [], modifiedIcons = [], renamedIcons = [];
+ if(version) {
+ cp.exec(`git diff ${version} HEAD --name-status`, function (err, ret) {
- ret.replace(/A\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) {
- newIcons.push(fileName);
- });
+ let newIcons = [], modifiedIcons = [], renamedIcons = [];
- ret.replace(/M\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) {
- modifiedIcons.push(fileName);
- });
+ ret.replace(/A\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) {
+ newIcons.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]);
- });
+ ret.replace(/M\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) {
+ modifiedIcons.push(fileName);
+ });
- modifiedIcons = modifiedIcons.filter(function (el) {
- return newIcons.indexOf(el) < 0;
+ 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;
+ });
+
+ printChangelog(newIcons, modifiedIcons, renamedIcons);
+
+ cb();
});
+ }
+});
- printChangelog(newIcons, modifiedIcons, renamedIcons);
+gulp.task('changelog-image', function (cb) {
+ const version = argv['latest-version'] || `${p.version}`,
+ newVersion = argv['new-version'] || `${p.version}`;
+
+ if(version) {
+ cp.exec(`git diff v${version} HEAD --name-status`, function (err, ret) {
+
+ let newIcons = [];
+ ret.replace(/[AD]\s+src\/_icons\/([a-z1-9-]+)\.svg/g, function (m, fileName) {
+ newIcons.push(fileName);
+ });
+
+ newIcons = newIcons.map(function(icon){
+ return `./icons/${icon}.svg`;
+ });
+
+ if(newIcons.length > 0) {
+ generateIconsPreview(newIcons, `packages/tabler-icons-${newVersion}.svg`, cb, 6);
+ } else {
+ cb();
+ }
+ });
+ } else {
cb();
- });
+ }
});
gulp.task('svg-to-png', gulp.series('build-jekyll', 'clean-png', async (cb) => {
- let files = glob.sync("_site/icons/*.svg");
+ let files = glob.sync("./icons/*.svg");
await asyncForEach(files, async function (file, i) {
let name = path.basename(file, '.svg');
@@ -355,4 +382,4 @@ gulp.task('svg-to-png', gulp.series('build-jekyll', 'clean-png', async (cb) => {
cb();
}));
-gulp.task('build', gulp.series('optimize', 'build-jekyll', 'build-copy', 'icons-sprite', 'icons-preview', 'svg-to-png', 'build-zip'));
+gulp.task('build', gulp.series('optimize', 'build-jekyll', 'build-copy', 'icons-sprite', 'icons-preview', 'svg-to-png', 'changelog-image', 'build-zip'));
diff --git a/package.json b/package.json
index d216e1f..cd9423f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "tabler-icons",
- "version": "1.0.3",
+ "version": "1.0.4",
"repository": {
"type": "git",
"url": "git+https://github.com/tabler/tabler-icons.git"
@@ -41,11 +41,11 @@
},
"release-it": {
"hooks": {
- "after:bump": "npm run build",
- "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
+ "after:bump": "npm run build --latest-version ${latestVersion} --new-version ${version}",
+ "after:release": "echo Successfully released ${name} v${latestVersion} to ${repo.repository}."
},
"git": {
- "changelog": "gulp changelog-diff --silent --latest-tag ${latestTag}",
+ "changelog": "gulp changelog --silent --latest-tag ${latestTag}",
"tagName": "v${version}",
"requireBranch": "master",
"requireCommits": true