From e81ea3db0b5a6de27cf9cd2d91b3c36e98109293 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 14 Nov 2022 02:03:23 +0100 Subject: [PATCH] Add check as to always have a source or an author --- assets/svg/teardrop_with_hole_green.svg | 57 ------------------------- assets/themes/width/license_info.json | 4 +- scripts/generateLicenseInfo.ts | 13 +++++- 3 files changed, 14 insertions(+), 60 deletions(-) delete mode 100644 assets/svg/teardrop_with_hole_green.svg diff --git a/assets/svg/teardrop_with_hole_green.svg b/assets/svg/teardrop_with_hole_green.svg deleted file mode 100644 index 947562fc3..000000000 --- a/assets/svg/teardrop_with_hole_green.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - diff --git a/assets/themes/width/license_info.json b/assets/themes/width/license_info.json index 20cd90555..2e786730b 100644 --- a/assets/themes/width/license_info.json +++ b/assets/themes/width/license_info.json @@ -2,7 +2,7 @@ { "path": "icon.svg", "license": "CC0; trivial", - "authors": [], + "authors": ["Pieter Vander Vennet"], "sources": [] } -] \ No newline at end of file +] diff --git a/scripts/generateLicenseInfo.ts b/scripts/generateLicenseInfo.ts index 3a8b7567b..5fbf819e7 100644 --- a/scripts/generateLicenseInfo.ts +++ b/scripts/generateLicenseInfo.ts @@ -279,7 +279,18 @@ function main(args: string[]) { const invalidLicenses = licenseInfos .filter((l) => (l.license ?? "") === "") .map((l) => `License for artwork ${l.path} is empty string or undefined`) + + let invalid = 0 for (const licenseInfo of licenseInfos) { + + if(licenseInfo.sources.length + licenseInfo.authors.length == 0){ + invalid++ + invalidLicenses.push( + "Invalid license: No sources nor authors given in the license for " + JSON.stringify(licenseInfo) + ) + continue + } + for (const source of licenseInfo.sources) { if (source == "") { invalidLicenses.push( @@ -294,7 +305,7 @@ function main(args: string[]) { } } - if (missingLicenses.length > 0) { + if (missingLicenses.length > 0 || invalidLicenses.length) { const msg = `There are ${missingLicenses.length} licenses missing and ${invalidLicenses.length} invalid licenses.` console.log(missingLicenses.concat(invalidLicenses).join("\n")) console.error(msg)