license-check
license-check is a npm plugin to check the presence of a specific header in all the files of a project, and give to you a log of all the files where the header is missing. Never miss again a license header in a file.
If you want to run this plugin from gulp you can use gulp-license-check.
Install
$ npm install --save-dev license-check
Usage
You can use this plugin in two ways:
Run it from npm
Add the following lines to your package.json :
"scripts": {
"licensecheck": "license-check",
},
"license-check-config": {
"src": [
"test/**/*",,
"src/**/*.js",
"/usr/lib",
"index.js",
"!./node_modules/**/*"
],
"path": "assets/header.txt",
"blocking": false,
"logInfo": false,
"logError": true
}
Then run from the terminal :
$ npm run licensecheck
The license-check-config section is mandatory, without this section the plugin will not work.
Include it in your node app
var license = require('license-check');
license.check({
src: [
'**/*',
'/usr/lib',
'!./node_modules/**/*'
],
path: "assets/header.txt",
blocking: false,
logInfo: false,
logError: true
});
Options
src: {string[]} (optional) default ['/*', '!node_modules/\/*'] . Path of the files you want to be checked by the plugin.
path: {string} (mandatory). Path of your header file, this is the header that has to match in all the files of the project.
blocking: {boolean} (optional) default true. If it's true, in case of missing header will block the build.
logInfo: {boolean} (optional) default true. If it's false the plugin doesn't show the info log.
logError: {boolean} (optional) default true. If it's false the plugin doesn't show the error log.
License
MIT © Mario Romano