-
Notifications
You must be signed in to change notification settings - Fork 1
/
printPackageVersion.js
39 lines (31 loc) · 1.29 KB
/
printPackageVersion.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
/**
* Created by Pankajan on 21/07/2016.
*/
var util = require('./util.js');
var parser = require('./definitionParser');
var ranTestGen = require('./randomTestGenerator');
var sutil = require('line-stream-util');
var filesystem = require("fs");
filesystem.readdirSync('/Users/Pankajan/Edinburgh/Source/JSRandomTester/node_modules').forEach(function(file) {
var stat = filesystem.statSync('/Users/Pankajan/Edinburgh/Source/JSRandomTester/node_modules'+'/'+file);
var dfFile = '/Users/Pankajan/Edinburgh/Source/DefinitelyTyped/'+ file + '/' + file + '.d.ts';
if (stat && stat.isDirectory() && !file.startsWith('.') && filesystem.existsSync(dfFile)) {
try {
var pjson = require(file + '/package.json');
//console.log(pjson.version);
filesystem.createReadStream(dfFile)
.pipe(sutil.head(1)) // get head lines
.pipe(sutil.split())
.setEncoding('utf8')
.on('data', function(data){
var matches = data.match(/\d+/g);
if (matches != null) {
console.log(data);
console.log(pjson.version);
}
});
} catch (err) {
console.log(err.stack);
}
}
});