Created
March 30, 2016 15:41
-
-
Save platinumazure/db007afaf17fa7d84e15616f56b11742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2016 Kevin Partington. Licensed freely to the public domain. | |
// N.B. You will need to run this in the root of an ESLint repository. | |
var path = require("path"); | |
var semver = require("semver"); | |
var shelljs = require("shelljs"); | |
if (process.argv.length < 3) { | |
console.error("Must specify ESLint version"); | |
console.error("Usage: " + process.argv.slice(0, 2).join(" ") + " VERSION"); | |
return 1; | |
} | |
var sinceVersion = semver.valid(process.argv[2]); | |
if (!sinceVersion) { | |
console.error("Invalid ESLint version (must be semver-compliant)"); | |
console.error("Usage: " + process.argv.slice(0, 2).join(" ") + " VERSION"); | |
return 1; | |
} | |
function execSilent(command) { | |
return shelljs.exec(command, { silent: true }).output; | |
} | |
shelljs.find("./lib/rules").forEach(function (file) { | |
if (shelljs.test("-f", file) && path.extname(file) === ".js") { | |
var commits = execSilent("git rev-list HEAD -- " + file) | |
.trim() | |
.split("\n"); | |
var firstCommit = commits[commits.length - 1].trim(); | |
var tags = execSilent("git tag --contains " + firstCommit) | |
.trim() | |
.split("\n"); | |
var firstTag = tags.filter(function (version) { | |
version = semver.valid(version.trim()); | |
return version; | |
}).sort(semver.compare)[0]; | |
if (semver.gt(firstTag, sinceVersion)) { | |
console.log(file + ": " + firstTag); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment