@@ -13,6 +13,7 @@ const fs = require('fs')
13
13
14
14
, transformFilename = require ( './transform-filename' )
15
15
, decodeRef = require ( './decode-ref' )
16
+ , isSecurityRelease = require ( './is-security-release' )
16
17
17
18
, versionCachePath = path . join ( process . env . HOME , '.dist-indexer-version-cache' )
18
19
@@ -39,6 +40,7 @@ const fs = require('fs')
39
40
, `${ githubContentUrl } /src/node.h`
40
41
]
41
42
, ltsVersionUrl = `${ githubContentUrl } /src/node_version.h`
43
+ , isSecurityUrl = 'https://github.com/nodejs/{repo}/commits/{gitref}.atom'
42
44
, githubOptions = { headers : {
43
45
'accept' : 'text/plain,application/vnd.github.v3.raw'
44
46
} }
@@ -339,6 +341,23 @@ function fetchLtsVersion (gitref, callback) {
339
341
}
340
342
341
343
344
+ function fetchSecurity ( gitref , callback ) {
345
+ var security = cacheGet ( gitref , 'security' )
346
+
347
+ if ( security || security === false )
348
+ return setImmediate ( callback . bind ( null , null , security ) )
349
+
350
+ fetch ( isSecurityUrl , gitref , function ( err , rawData ) {
351
+ if ( err )
352
+ return callback ( err )
353
+
354
+ security = isSecurityRelease ( rawData )
355
+ cachePut ( gitref , 'security' , security )
356
+ callback ( null , security )
357
+ } )
358
+ }
359
+
360
+
342
361
function dirDate ( dir , callback ) {
343
362
fs . readdir ( path . join ( argv . dist , dir ) , function ( err , files ) {
344
363
if ( err )
@@ -392,6 +411,7 @@ function inspectDir (dir, callback) {
392
411
, zlibVersion
393
412
, modVersion
394
413
, ltsVersion
414
+ , securityRelease
395
415
, date
396
416
397
417
if ( ! gitref ) {
@@ -412,7 +432,7 @@ function inspectDir (dir, callback) {
412
432
413
433
files = _files
414
434
415
- var done = after ( 8 , afterAll )
435
+ var done = after ( 9 , afterAll )
416
436
417
437
dirDate ( dir , function ( err , _date ) {
418
438
if ( err )
@@ -484,6 +504,15 @@ function inspectDir (dir, callback) {
484
504
ltsVersion = version
485
505
done ( )
486
506
} )
507
+
508
+ fetchSecurity ( gitref , function ( err , security ) {
509
+ if ( err ) {
510
+ console . error ( err )
511
+ console . error ( '(ignoring error fetching security release for %s)' , gitref )
512
+ }
513
+ securityRelease = security
514
+ done ( )
515
+ } )
487
516
} )
488
517
489
518
function afterAll ( err ) {
@@ -504,6 +533,7 @@ function inspectDir (dir, callback) {
504
533
, openssl : sslVersion
505
534
, modules : modVersion
506
535
, lts : ltsVersion
536
+ , security : securityRelease
507
537
} )
508
538
}
509
539
}
@@ -533,7 +563,7 @@ function afterMap (err, dirs) {
533
563
}
534
564
535
565
jsonOut . write ( '[\n' )
536
- tabWrite ( 'version' , 'date' , 'files' , 'npm' , 'v8' , 'uv' , 'zlib' , 'openssl' , 'modules' , 'lts' )
566
+ tabWrite ( 'version' , 'date' , 'files' , 'npm' , 'v8' , 'uv' , 'zlib' , 'openssl' , 'modules' , 'lts' , 'security' )
537
567
538
568
dirs . forEach ( function ( dir , i ) {
539
569
jsonOut . write ( JSON . stringify ( dir ) + ( i != dirs . length - 1 ? ',\n' : '\n' ) )
@@ -548,6 +578,7 @@ function afterMap (err, dirs) {
548
578
, dir . openssl
549
579
, dir . modules
550
580
, dir . lts
581
+ , dir . security
551
582
)
552
583
} )
553
584
0 commit comments