-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (28 loc) · 954 Bytes
/
index.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
#!/usr/bin/env node
var checker = require('license-checker');
var Table = require('cli-table3');
// instantiate
var table = new Table({
head: ['license', 'repository', 'name', '@', 'version']
, style: {'padding-left':0, 'padding-right':0}
, colAligns: ["left", "left", "right", "middle", "left"]
, chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' }
});
checker.init({
start: './',
summary: true,
production: true
}, function(err, json) {
if (err) {
return console.log(err);
} else {
Object.keys(json).forEach(function(k){
var b = k.split('@');
table.push([json[k].licenses, json[k].repository, b[0], '@', b[1]]);
});
console.log(table.toString());
}
});