grunt-bower-licensechecker
v0.1.2
Published
Bower License Checker is simple utility to make sure you can reuse someones code on commercial projects.
Downloads
403
Maintainers
Readme
Bower License Checker
Grunt plugin to test licenses in Bower components folder agains list provided. May display log while running or save in output file.
Getting Started
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-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-bower-licensechecker');
License Checker API
Overview
In your project's Gruntfile, add a section named 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,
}
}
},
Options
options.directory
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.
options.acceptable
Type: `Array{String}`
Default value: `[]`
Acceptable Values: `Array of Strings`
Array of licenses to test against.
options.printTotal
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.
options.warn
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.warn
. Otherwise, nothing is going to be printed.
Boolean Options:
nonBower
: Prints list of Non-Bower components detected in specified folder (in casebower.json
doesn't exist)noLicense
: Prints list of Bower components witout license inbower.json
allGood
: Prints list of Bower components that match license list atoptions.acceptable
noGood
: Prints list of Bower components that don't match license list atoptions.acceptable
options.log
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.json
doesn't exist)noLicense
: Writes list of Bower components witout license inbower.json
allGood
: Writes list of Bower components that match license list atoptions.acceptable
noGood
: Writes list of Bower components that don't match license list atoptions.acceptable
Contributing
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.