Remove licenses from non-existing images

This commit is contained in:
Pieter Vander Vennet 2021-11-07 15:03:03 +01:00
parent 9f821749a8
commit 2a6a2d4f24
5 changed files with 11 additions and 212 deletions

View file

@ -162,6 +162,17 @@ function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]) {
}
perDirectory.forEach((licenses, dir) => {
for (let i = licenses.length - 1; i >= 0; i--){
const license = licenses[i];
const path = dir+"/"+license.path
if(! existsSync(path)){
console.log("Found license for now missing file: ", path, " - removing this license")
licenses.splice(i, 1)
}
}
licenses.sort((a, b) => a.path < b.path ? -1 : 1)
writeFileSync(dir + "/license_info.json", JSON.stringify(licenses, null, 2))
})