1
1
#!/usr/bin/env node
2
2
3
- var baseDir , repoDir , prevVersion , newVersion , nextVersion , tagTime ,
3
+ var baseDir , repoDir , majorMinorVersion , patchVersion , prevVersion , newVersion ,
4
+ nextVersion , tagTime ,
4
5
fs = require ( "fs" ) ,
5
6
path = require ( "path" ) ,
6
7
// support: node <0.8
@@ -103,10 +104,14 @@ function getVersions() {
103
104
major = parseInt ( parts [ 0 ] , 10 ) ;
104
105
minor = parseInt ( parts [ 1 ] , 10 ) ;
105
106
patch = parseInt ( parts [ 2 ] , 10 ) ;
107
+
106
108
// TODO: handle 2.0.0
107
109
if ( minor === 0 ) {
108
110
abort ( "This script is not smart enough to handle the 2.0.0 release." ) ;
109
111
}
112
+
113
+ majorMinorVersion = [ major , minor ] . join ( "." ) ;
114
+ patchVersion = patch ;
110
115
prevVersion = patch === 0 ?
111
116
[ major , minor - 1 , 0 ] . join ( "." ) :
112
117
[ major , minor , patch - 1 ] . join ( "." ) ;
@@ -190,7 +195,14 @@ function generateChangelog() {
190
195
var commits ,
191
196
changelogPath = baseDir + "/changelog" ,
192
197
changelog = cat ( "build/release/changelog-shell" ) + "\n" ,
193
- fullFormat = "* %s (TICKETREF, [http://github.com/jquery/jquery-ui/commit/%H %h])" ;
198
+ fullFormat = "* %s (TICKETREF, [%h](http://github.com/jquery/jquery-ui/commit/%H))" ;
199
+
200
+ changelog = changelog
201
+ . replace ( "{title}" , "jQuery UI " + newVersion + " Changelog" )
202
+ . replace ( "{summary}" , patchVersion === 0 ?
203
+ "This is the final release of jQuery UI " + majorMinorVersion + "." :
204
+ "This is the " + ordinal ( patchVersion ) + " maintenance release for " +
205
+ "[jQuery UI " + majorMinorVersion + "](/changelog/" + majorMinorVersion + ")." ) ;
194
206
195
207
echo ( "Adding commits..." ) ;
196
208
commits = gitLog ( fullFormat ) ;
@@ -205,7 +217,7 @@ function generateChangelog() {
205
217
} ) ;
206
218
return tickets . length ?
207
219
commit . replace ( "TICKETREF" , tickets . map ( function ( ticket ) {
208
- return "[http://bugs.jqueryui.com/ticket/" + ticket + " #" + ticket + "] ";
220
+ return "[#" + ticket + "]( http://bugs.jqueryui.com/ticket/" + ticket + ") " ;
209
221
} ) . join ( ", " ) ) :
210
222
// Leave TICKETREF token in place so it's easy to find commits without tickets
211
223
commit ;
@@ -318,6 +330,30 @@ function writePackage( pkg ) {
318
330
JSON . stringify ( pkg , null , "\t" ) + "\n" ) ;
319
331
}
320
332
333
+ function ordinal ( number ) {
334
+ return number === 1 ? "first" :
335
+ number === 2 ? "second" :
336
+ number === 3 ? "third" :
337
+ number === 4 ? "fourth" :
338
+ number === 5 ? "fifth" :
339
+ number === 6 ? "sixth" :
340
+ number === 7 ? "seventh" :
341
+ number === 8 ? "eighth" :
342
+ number === 9 ? "ninth" :
343
+ number === 10 ? "tenth" :
344
+ number === 11 ? "eleventh" :
345
+ number === 12 ? "twelfth" :
346
+ number === 13 ? "thirteenth" :
347
+ number === 14 ? "fourteenth" :
348
+ number === 15 ? "fifteenth" :
349
+ number === 16 ? "sixteenth" :
350
+ number === 17 ? "seventeenth" :
351
+ number === 18 ? "eighteenth" :
352
+ number === 19 ? "nineteenth" :
353
+ number === 20 ? "twentieth" :
354
+ "twenty " + ordinal ( number - 20 ) ;
355
+ }
356
+
321
357
function bootstrap ( fn ) {
322
358
console . log ( "Determining directories..." ) ;
323
359
baseDir = process . cwd ( ) + "/__release" ;
0 commit comments