Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

fix: data duplication to the output. #168

Merged
merged 3 commits into from
Sep 20, 2017
Merged
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
6 changes: 5 additions & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ function addLicenseEntryIgnoreVersionRange (xmlElement, identifier, json, option
xmlElement.dependencies.dependency.push(entry(json[key], nameVersion, options));
}
}
xmlElement.dependencies.dependency = xmlElement.dependencies.dependency
.filter((d, index, self) => self.findIndex((t) => {
return t.version === d.version && t.licenses.license[0].name === d.licenses.license[0].name;
}) === index);
return xmlElement;
}

Expand Down Expand Up @@ -120,7 +124,7 @@ function showWarnings (options, declaredDependencies, xmlObject) {
.filter(e1 => xmlObjectDependencies
.filter(e2 => e2 === e1)
.length === 0);
if (missingDependencies.length > 0) {
if (missingDependencies.length > 0 && !options.ignoreVersionRange) {
console.log(`Dependencies found in package.json but not in xml: ${missingDependencies.join(',')}`);
console.log(`Please run 'license-reporter --ignore-version-range' to show all declared dependencies on generated xml.`);
}
Expand Down