marktext/.electron-vue/thirdPartyChecker.js
Ran Luo 46371f8c56
Update Babel to 7.x.x (#1253)
* update deps

* update babel

* add babel-runtime

* update config file

* update config file

* modify config

* modify some codes

* update some dependences

* Update allowed licenses validate
2019-09-01 03:30:01 +08:00

38 lines
965 B
JavaScript

'use strict'
const checker = require('license-checker')
const getLicenses = (rootDir, callback) => {
checker.init({
start: rootDir,
production: true,
development: false,
direct: true,
excludePackages: 'xmldom@0.1.27', // xmldom@0.1.27 is under MIT License, but license-checker show it's under LGPL License.
json: true,
onlyAllow: 'Unlicense;WTFPL;ISC;MIT;BSD;ISC;Apache-2.0;MIT*;Apache*;BSD*;CC0-1.0;CC-BY-4.0;CC-BY-3.0',
customPath: {
licenses: '',
licenseText: 'none'
}
}, function (err, packages) {
callback(err, packages, checker)
})
}
// Check that all production dependencies are allowed.
const validateLicenses = rootDir => {
getLicenses(rootDir, (err, packages, checker) => {
if (err) {
console.log(`[ERROR] ${err}`)
process.exit(1)
}
console.log(checker.asSummary(packages))
})
}
module.exports = {
getLicenses: getLicenses,
validateLicenses: validateLicenses
}