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