Grunt plugin to test licenses in Bower components folder agains list provided. May display log while running or save in output file.
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-bower-licensechecker --save-devOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-bower-licensechecker');In your project's Gruntfile, add a section named 'bower-licensechecker' to the data object passed into grunt.initConfig().
'bower-licensechecker': {
options: {
directory: 'path/to/bower',
acceptable: [ 'MIT', 'BSD' ],
printTotal: true,
warn: {
nonBower: true,
noLicense: true,
allGood: true,
noGood: true
},
log: {
outFile: '.licenses',
nonBower: true,
noLicense: true,
allGood: true,
noGood: true,
}
}
},Type: `String`
Default value: `bower_components`
Acceptable Values: `null`, `String`
Path to Bower directory. If null it will look for .bowerrc and get path from Bower config.
Type: `Array{String}`
Default value: `[]`
Acceptable Values: `Array of Strings`
Array of licenses to test against.
Type: `Boolean`
Default value: `false`
Acceptable Values: `true`, `false`
If true, prints total summary for Good, Bad, Not specified Licenses and if it's considered Non-Bower component.
Type: `Object`
Default value: `null`
Acceptable Values: `Object`, `null`, `false`
If {} or true, it will print generic state of the performed check using grunt.log.ok or grunt.log.error. Otherwise, nothing is going to be printed.
Boolean Options:
nonBower: Prints list of Non-Bower components detected in specified folder (in casebower.jsondoesn't exist)noLicense: Prints list of Bower components witout license inbower.jsonallGood: Prints list of Bower components that match license list atoptions.acceptablenoGood: Prints list of Bower components that don't match license list atoptions.acceptable
Type: `Object`
Default value: `null`
Acceptable Values: `Object`, `null`, `false`
Required param: `outFile`
outFile must be specified in order for output file to be made. If no other options are provided the output file will be empty.
Boolean Options:
nonBower: Writes list of Non-Bower components detected in specified folder (in casebower.jsondoesn't exist)noLicense: Writes list of Bower components witout license inbower.jsonallGood: Writes list of Bower components that match license list atoptions.acceptablenoGood: Writes list of Bower components that don't match license list atoptions.acceptable
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.