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

Fixes #177, --packages and --excludePackages filtering #178

Merged
merged 1 commit into from
Oct 9, 2018

Conversation

jonny-improbable
Copy link
Contributor

@jonny-improbable jonny-improbable commented Oct 9, 2018

The filtering logic for both --packages and --excludePackages was broken if the output was being colorized.

To work around this I have moved the colorization out of the parsing logic and into the formatting.

WRT to removing strip-ansi, I'm not convinced this package was actually being imported anywhere before this change, but I couldn't find it referenced anywhere in the code so I've removed it for good hygine.

The filtering logic for both `--packages` and `--excludePackages` was broken if the output was being colorized.

To work around this I have moved the colorization out of the parsing logic and into the formatting.

This change means we no longer need to use `strip-colors` so I've removed this as a dependency.

if (shouldColorizeOutput(args)) {
var keys = Object.keys(json);
keys.forEach(function(key) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a little bit ugly; tbh the colorisation of the key should be performed inside the formatter, however this is a pragmatic fix if you're OK with it for now :)

@@ -35,12 +34,6 @@ var flatten = function(options) {
readmeFile,
licenseData, dirFiles, files = [], noticeFiles = [], licenseFile;

/*istanbul ignore next*/
if (colorize) {
moduleInfo = { licenses: chalk.bold.red(UNKNOWN) };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

initialising the license had nothing to do with colorising.

@davglass davglass merged commit ec185c5 into davglass:master Oct 9, 2018
@davglass
Copy link
Owner

davglass commented Oct 9, 2018

Published in [email protected]

@jonny-improbable jonny-improbable deleted the fix/filtering branch October 9, 2018 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants