github-api-tags-full
Advanced tools
Comparing version 5.0.0 to 6.0.0
var GitHubApi = require('github'), | ||
GithubApiTags = require('./'), | ||
path = require('path'), | ||
ProgressBar = require('progress'); | ||
ProgressBar = require('progress'), | ||
moment = require('moment'); | ||
@@ -22,3 +23,3 @@ var repoId = { | ||
var bar = new ProgressBar('Fetching commit :current/:total [:bar] :percent :etas', { total: 100 }); | ||
var bar = new ProgressBar('Fetching tag/commit :current/:total [:bar] :percent :etas', { total: 100 }); | ||
@@ -32,6 +33,20 @@ var tagChanged = function() { | ||
var byAuthorDateAsc = function(tagA, tagB) { | ||
return githubCompareDates( | ||
tagA.commit.author.date, | ||
tagB.commit.author.date | ||
); | ||
}; | ||
var githubCompareDates = function(dateStrA, dateStrB) { | ||
return moment(dateStrA).diff(dateStrB); | ||
}; | ||
console.log('...'); | ||
gat.fetch(repoId, github) | ||
.then(function(tags) { | ||
console.log('All tags fetched, ready for sorting.'); | ||
var tagsSortedDateDesc = tags.sort(byAuthorDateAsc).reverse(); | ||
console.log('Tags sorted:'); | ||
console.log(tagsSortedDateDesc); | ||
}); |
@@ -72,2 +72,3 @@ var Promise = require('bluebird'), | ||
self.emit('tag-commit', tagCommit); | ||
return tagCommit; | ||
}); | ||
@@ -74,0 +75,0 @@ }); |
@@ -10,3 +10,3 @@ { | ||
"name": "github-api-tags-full", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Gets all tags with their respective commit for sorting from Github API", | ||
@@ -13,0 +13,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8307
127