release-notes.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env node
  2. /*
  3. * jQuery Release Note Generator
  4. */
  5. var fs = require("fs"),
  6. http = require("http"),
  7. tmpl = require("mustache"),
  8. extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g;
  9. var opts = {
  10. version: "1.8.3",
  11. short_version: "1.8.3",
  12. final_version: "1.8.3",
  13. categories: []
  14. };
  15. http.request({
  16. host: "bugs.jquery.com",
  17. port: 80,
  18. method: "GET",
  19. path: "/query?status=closed&resolution=fixed&max=400&component=!web&order=component&milestone=" + opts.final_version
  20. }, function (res) {
  21. var data = [];
  22. res.on( "data", function( chunk ) {
  23. data.push( chunk );
  24. });
  25. res.on( "end", function() {
  26. var match,
  27. file = data.join(""),
  28. cur;
  29. while ( (match = extract.exec( file )) ) {
  30. if ( "#" + match[1] !== match[2] ) {
  31. var cat = match[3];
  32. if ( !cur || cur.name !== cat ) {
  33. cur = { name: match[3], niceName: match[3].replace(/^./, function(a){ return a.toUpperCase(); }), bugs: [] };
  34. opts.categories.push( cur );
  35. }
  36. cur.bugs.push({ ticket: match[1], title: match[2] });
  37. }
  38. }
  39. buildNotes();
  40. });
  41. }).end();
  42. function buildNotes() {
  43. console.log( tmpl.to_html( fs.readFileSync("release-notes.txt", "utf8"), opts ) );
  44. }