Skip to content

Commit

Permalink
Fix errors and update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
RSeidelsohn committed Aug 30, 2024
1 parent da24ced commit c78518f
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 174 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Changes](#changes)
- [Version 4.4.1](#Version-4-4-1)
- [Version 4.4.0](#Version-4-4-0)
- [Version 4.3.1](#Version-4-3-1)
- [Version 4.3.0](#Version-4-3-0)
Expand Down Expand Up @@ -127,6 +128,10 @@ You could see something like this:

## <a id="changes"></a>Changes (see a more detailed and always up-to-date list [here](https://github.com/RSeidelsohn/license-checker-rseidelsohn/releases))

### <a id="Version-4-4-1"></a>Version 4.4.1

fix: Fix errors that broke the whole new version (sorry for these)

### <a id="Version-4-4-0"></a>Version 4.4.0

chore(deps-dev): bump braces from 3.0.2 to 3.0.3 by @dependabot in https://github.com/RSeidelsohn/license-checker-rseidelsohn/pull/114
Expand Down
2 changes: 1 addition & 1 deletion lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import path from 'node:path';

const knownOptions = {
angularCli: Boolean,
clarificationsFile: path,clarificationsMatchAll
clarificationsFile: path,
clarificationsMatchAll: Boolean,
color: Boolean,
csv: Boolean,
Expand Down
20 changes: 12 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ const recursivelyCollectAllDependencies = (options) => {
let licenseData;
let licenseFile;
let noticeFiles = [];
const clarification = options.clarifications[currentExtendedPackageJson.name]?.find((clarification) =>
currentExtendedPackageJson.version == clarification.semverRange || semver.satisfies(currentExtendedPackageJson.version, clarification.semverRange)
const clarification = options.clarifications[currentExtendedPackageJson.name]?.find(
(clarification) =>
currentExtendedPackageJson.version == clarification.semverRange ||
semver.satisfies(currentExtendedPackageJson.version, clarification.semverRange),
);
let passedClarificationCheck = clarification?.checksum ? false : true;
if (clarification) {
Expand Down Expand Up @@ -411,7 +413,7 @@ const init = (args, callback) => {
const semverRange = versionString.slice(versionSplit + 1);
clarifications[name] ??= [];
// keep track for each clarification if it was used, optionally error when not
clarifications[name].push({...clarification, semverRange, used: false});
clarifications[name].push({ ...clarification, semverRange, used: false });
}
}
}
Expand Down Expand Up @@ -449,20 +451,22 @@ const init = (args, callback) => {
unknown: args.unknown,
currentRecursionDepth: 0,
clarifications,
})
});

if (args.clarificationsMatchAll) {
const unusedClarifications = []
for (const [package, entries] of Object.entries(clarifications)) {
const unusedClarifications = [];
for (const [packageName, entries] of Object.entries(clarifications)) {
for (const clarification of entries) {
if (!clarification.used) {
unusedClarifications.push(`${package}@${clarification.semverRange}`);
unusedClarifications.push(`${packageName}@${clarification.semverRange}`);
}
}
}
if (unusedClarifications.length) {
console.error(
`Some clarifications (${unusedClarifications.join(', ')}) were unused and --clarificationsMatchAll was specified. Exiting.`,
`Some clarifications (${unusedClarifications.join(
', ',
)}) were unused and --clarificationsMatchAll was specified. Exiting.`,
);

process.exit(1);
Expand Down
Loading

0 comments on commit c78518f

Please sign in to comment.