RSeidelsohn/license-checker-rseidelsohn

excludePackagesStartingWith overrides excludePackages

Closed this issue · 0 comments

Currently it's not possible to combine the two exclusion lists to filter out packages in different ways, such as --excludePackagesStartingWith="@mystartup/" --excludePackages='spdx-exceptions;spdx-license-ids'. Specifically, excludePackagesStartingWith overrides the results from excludePackages in

let resultJson = { ...filtered };
// package whitelist
const whitelist = getOptionArray(args.includePackages);
if (whitelist) {
resultJson = onlyIncludeWhitelist(whitelist, filtered);
}
// package blacklist
const blacklist = getOptionArray(args.excludePackages);
if (blacklist) {
resultJson = excludeBlacklist(blacklist, filtered);
}
// exclude by package name starting with a string
const excludeStartString = getOptionArray(args.excludePackagesStartingWith);
if (excludeStartString) {
resultJson = excludePackagesStartingWith(excludeStartString, filtered);
}
if (args.excludePrivatePackages) {
Object.keys(filtered).forEach(filterDeletePrivatePackages);
}

Would you be open to a PR to fix this, so it's possible to use both of those options?