Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for ignoring devDependencies via boolean config option ignoreDevDependencies #9

Merged
merged 2 commits into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ $ ./node_modules/.bin/license-to-fail init

`warnOnUnknown`: instead of erroring on packages with an `UNKNOWN` license, just warn. (false by default)

`ignoreDevDependencies`: do not check licenses for devDependencies. (false by default)

```js
// ./config.js
module.exports = {
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function checkLicenses(config) {
var allowedPackages = config.allowedPackages || [];
var warnOnUnknown = config.warnOnUnknown || false;
var configPath = config.configPath;
var ignoreDevDependencies = config.ignoreDevDependencies || false;

function log(dep) {
var type = 'INDIRECT DEP';
Expand Down Expand Up @@ -47,7 +48,8 @@ module.exports = function checkLicenses(config) {
}

checker.init({
start: process.cwd()
start: process.cwd(),
production: ignoreDevDependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool --production only show production dependencies. https://github.com/davglass/license-checker#options

}, function(err, json) {
var prohibitedDeps = Object.keys(json)
.map(function(dep) {
Expand Down