Skip to content

Commit

Permalink
add instructions on how to add an entry to allowedPackages
Browse files Browse the repository at this point in the history
  • Loading branch information
hzoo committed Sep 7, 2016
1 parent fd8a920 commit 1436495
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions bin/license-to-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if (configPath) {
}
}

config.configPath = path.resolve(configPath);
config.__currentPackage = {
name: packageJson.name,
dependencies: packageJson.dependencies || [],
Expand Down
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function checkLicenses(config) {
var allowedLicenses = config.allowedLicenses;
var allowedPackages = config.allowedPackages;
var warnOnUnknown = config.warnOnUnknown;
var configPath = config.configPath;

function log(dep) {
var type = 'INDIRECT DEP';
Expand All @@ -27,7 +28,7 @@ module.exports = function checkLicenses(config) {
type = 'OPTIONALDEP';
}

console.log(type + ' - ' + dep.name + ' ' + dep.licenses + ': ' + dep.repository);
console.error(type + ' - ' + dep.name + ' ' + dep.licenses + ': ' + dep.repository);
}

function isAllowedDependency(dependency) {
Expand Down Expand Up @@ -81,6 +82,19 @@ module.exports = function checkLicenses(config) {
return aLower < bLower ? -1 : aLower > bLower ? 1 : 0;
});
prohibitedDeps.map(function(dep) { log(dep); });

console.log('');
console.log('If you need to add an exception for the disallowed packages,');
console.log('You will want to modify the config file: ' + configPath);
console.log('by adding an new entry to the allowedPackages array.');
console.log('');
console.log('It takes in an object with a name key:');
console.log('{');
console.log(' "name": "allowed-package-name-here",');
console.log(' "reason": "reason for allowing" // optional');
console.log('}');
console.log('For more info: check out the repo https://github.com/behance/license-to-fail');

process.exit(1);
}
});
Expand Down

0 comments on commit 1436495

Please sign in to comment.