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