Skip to content

Commit

Permalink
No issue: Split make.js into bin/build and bin/changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
valueof committed Aug 2, 2013
1 parent 4ac19fa commit 96ea1a8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 83 deletions.
30 changes: 30 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env node
/*jshint shelljs:true */

"use strict";

var browserify = require("browserify");
var bundle = browserify("./src/stable/jshint.js");
var version = require("../package.json").version;
require("shelljs/make");

if (!test("-e", "../dist"))
mkdir("../dist");

bundle.require("./src/stable/jshint.js", { expose: "jshint" });
bundle.bundle({}, function (err, src) {
var web = "./dist/jshint-" + version + ".js";
var rhino = "./dist/jshint-rhino-" + version + ".js";

[ "// " + version,
"var JSHINT;",
"(function () {",
"var require;",
src,
"JSHINT = require('jshint').JSHINT;",
"}());"
].join("\n").to(web);

("#!/usr/bin/env rhino\nvar window = {};\n" + cat(web, "./src/platforms/rhino.js")).to(rhino);
chmod("+x", rhino);
});
36 changes: 36 additions & 0 deletions bin/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env node
/*jshint shelljs:true, lastsemic:true, -W101*/

"use strict";

var version = require("../package.json").version;
require("shelljs/make");

exec("git log --format='%H|%h|%an|%s' " + version + "..HEAD", { silent: true }, function (code, output) {
if (code !== 0)
return void console.log("git log return code is non-zero");

var commits = output.split("\n")
.filter(function (cmt) { return cmt.trim() !== "" })
.map(function (cmt) { return cmt.split("|") });

var html = "";
var authors = {};

commits.forEach(function (cmt) {
var tr = "";
tr += "<td class='commit'><a href='https://github.com/jshint/jshint/commit/" + cmt[0] + "'>" + cmt[1] + "</a></td>";
tr += "<td class='desc'>" + cmt[3].replace(/(#(\d+))/, "<a href='https://github.com/jshint/jshint/issues/$2/'>$1</a>") + "</td>";
html += "<tr>" + tr + "</tr>\n";

if (cmt[2] !== "Anton Kovalyov")
authors[cmt[2]] = true;
});

echo("<!-- auto-generated -->");
echo("<table class='changelog'>\n" + html + "</table>\n");

if (Object.keys(authors).length) {
echo("<p class='thx'><strong>Thanks</strong> to " + Object.keys(authors).join(", ") + " for sending patches!</p>");
}
});
83 changes: 0 additions & 83 deletions make.js

This file was deleted.

0 comments on commit 96ea1a8

Please sign in to comment.