sitespeed.io
Version:
sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
48 lines (43 loc) • 1.14 kB
JavaScript
/*eslint no-console: 0*/
import { init } from 'license-checker';
init(
{
start: '.'
},
function (error, json) {
if (error) {
console.error(error.message);
process.exit(1);
} else {
const incompatibleDependencies = Object.keys(json).filter(packageName => {
let licenses = json[packageName].licenses;
if (!Array.isArray(licenses)) licenses = [licenses];
if (
licenses
.filter(
license =>
!(
/LGPL/.test(license) ||
/MIT/.test(license) ||
/BSD/.test(license)
)
)
.some(license => license.match(/GPL/))
)
return packageName;
});
if (incompatibleDependencies.length > 0) {
console.error(
'Found packages with incompatible license: ' +
JSON.stringify(incompatibleDependencies)
);
process.exit(1);
} else {
console.log(
'All is well! No packages with an incompatible license found.'
);
}
}
}
);