1
0

release-notes.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env node
  2. /*
  3. * jQuery Release Note Generator
  4. */
  5. var fs = require("fs"),
  6. http = require("http"),
  7. extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g,
  8. categories = [],
  9. version = process.argv[2];
  10. if ( !/^\d+\.\d+/.test( version ) ) {
  11. console.error( "Invalid version number: " + version );
  12. process.exit( 1 );
  13. }
  14. http.request({
  15. host: "bugs.jquery.com",
  16. port: 80,
  17. method: "GET",
  18. path: "/query?status=closed&resolution=fixed&max=400&component=!web&order=component&milestone=" + version
  19. }, function (res) {
  20. var data = [];
  21. res.on( "data", function( chunk ) {
  22. data.push( chunk );
  23. });
  24. res.on( "end", function() {
  25. var match,
  26. file = data.join(""),
  27. cur;
  28. while ( (match = extract.exec( file )) ) {
  29. if ( "#" + match[1] !== match[2] ) {
  30. var cat = match[3];
  31. if ( !cur || cur !== cat ) {
  32. if ( cur ) {
  33. console.log("</ul>");
  34. }
  35. cur = cat;
  36. console.log( "<h3>" + cat.charAt(0).toUpperCase() + cat.slice(1) + "</h3>" );
  37. console.log("<ul>");
  38. }
  39. console.log(
  40. " <li><a href=\"http://bugs.jquery.com/ticket/" + match[1] + "\">#" +
  41. match[1] + ": " + match[2] + "</a></li>"
  42. );
  43. }
  44. }
  45. if ( cur ) {
  46. console.log("</ul>");
  47. }
  48. });
  49. }).end();