mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 15:40:50 +08:00

* 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
38 lines
965 B
JavaScript
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
|
|
}
|