Fix the order of the licenses

This commit is contained in:
Pieter Vander Vennet 2021-09-08 01:53:37 +02:00
parent a4f4365d71
commit 8344fcc4eb
69 changed files with 2084 additions and 2081 deletions

View file

@ -87,7 +87,6 @@ knownLicenses.set("na", {
})
function promptLicenseFor(path): SmallLicense {
console.log("License abbreviations:")
knownLicenses.forEach((value, key) => {
@ -144,10 +143,18 @@ function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]) {
if (!perDirectory.has(dir)) {
perDirectory.set(dir, [])
}
perDirectory.get(dir).push(license)
const cloned : SmallLicense = {
// We make a clone to force the order of the keys
path: license.path,
license: license.license,
authors: license.authors,
sources: license.sources
}
perDirectory.get(dir).push(cloned)
}
perDirectory.forEach((licenses, dir) => {
licenses.sort((a, b) => a.path < b.path ? -1 : 1)
writeFileSync(dir + "/license_info.json", JSON.stringify(licenses, null, 2))
})