Skip to content

Instantly share code, notes, and snippets.

@dtex
Forked from lirantal/index.js
Last active March 26, 2017 03:09
Show Gist options
  • Save dtex/70b21fd876a889d10156e9ff74430635 to your computer and use it in GitHub Desktop.
Save dtex/70b21fd876a889d10156e9ff74430635 to your computer and use it in GitHub Desktop.
LicenseWatch-CLI With Blessed UI
'use strict'
const LicenseWatch = require('licensewatch')
const blessed = require('blessed')
const blessedContrib = require('blessed-contrib')
const fs = require('fs')
const Barcli = require('barcli')
const licenses = new LicenseWatch(getModulesDirectory())
licenses.fetch()
licenses.on('licensesSummary', (data) => {
for (let license in data.licenses) {
var graph = new Barcli({
label: license,
range: [0, data.maxLicense.count],
});
graph.update(data.licenses[license])
}
})
function getModulesDirectory() {
return process.cwd() + '/node_modules/**/package.json'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment