<img src='https://travis-ci.org/magemello/license-check.svg?branch=master' alt='travis Status' />
<img src='https://coveralls.io/repos/github/magemello/license-check/badge.svg?branch=master' alt='Coverage Status' />
<img src='https://img.shields.io/npm/dm/license-check.svg' alt='npm downloads' />
<img src='https://img.shields.io/badge/license-MIT-blue.svg' alt='license' />
<img src='https://img.shields.io/badge/unicorn-approved-ff69b4.svg' alt='unicorn' />
<img src='https://img.shields.io/badge/style-blog-blue.svg?label=my' alt='my blog' />
<img src='https://img.shields.io/badge/style-portfolio-orange.svg?label=my' alt='my portfolio' />
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 '/\*', '!nodemodules/\**/\*' . 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.