Typing improvements
This commit is contained in:
parent
8b6ee7075c
commit
f2d2240896
1 changed files with 3 additions and 5 deletions
|
@ -344,11 +344,11 @@ export class GenerateLicenseInfo extends Script {
|
||||||
mkdirSync("./src/assets/generated")
|
mkdirSync("./src/assets/generated")
|
||||||
}
|
}
|
||||||
|
|
||||||
let contents = ScriptUtils.readDirRecSync("./assets").filter(
|
const contents = ScriptUtils.readDirRecSync("./assets").filter(
|
||||||
(entry) => entry.indexOf("./assets/generated") != 0
|
(entry) => entry.indexOf("./assets/generated") != 0
|
||||||
)
|
)
|
||||||
let licensePaths = contents.filter((entry) => entry.indexOf("license_info.json") >= 0)
|
const licensePaths = contents.filter((entry) => entry.indexOf("license_info.json") >= 0)
|
||||||
let licenseInfos = this.generateLicenseInfos(licensePaths)
|
const licenseInfos = this.generateLicenseInfos(licensePaths)
|
||||||
|
|
||||||
const artwork = contents.filter(
|
const artwork = contents.filter(
|
||||||
(pth) => pth.match(/(.svg|.png|.jpg|.ttf|.otf|.woff|.jpeg)$/i) != null
|
(pth) => pth.match(/(.svg|.png|.jpg|.ttf|.otf|.woff|.jpeg)$/i) != null
|
||||||
|
@ -363,14 +363,12 @@ export class GenerateLicenseInfo extends Script {
|
||||||
.filter((l) => (l.license ?? "") === "")
|
.filter((l) => (l.license ?? "") === "")
|
||||||
.map((l) => `License for artwork ${l.path} is empty string or undefined`)
|
.map((l) => `License for artwork ${l.path} is empty string or undefined`)
|
||||||
|
|
||||||
let invalid = 0
|
|
||||||
for (const licenseInfo of licenseInfos) {
|
for (const licenseInfo of licenseInfos) {
|
||||||
const isTrivial = licenseInfo.license
|
const isTrivial = licenseInfo.license
|
||||||
.split(";")
|
.split(";")
|
||||||
.map((l) => l.trim().toLowerCase())
|
.map((l) => l.trim().toLowerCase())
|
||||||
.some((s) => s.endsWith("trivial"))
|
.some((s) => s.endsWith("trivial"))
|
||||||
if (licenseInfo.sources.length + licenseInfo.authors.length == 0 && !isTrivial) {
|
if (licenseInfo.sources.length + licenseInfo.authors.length == 0 && !isTrivial) {
|
||||||
invalid++
|
|
||||||
invalidLicenses.push(
|
invalidLicenses.push(
|
||||||
"Invalid license: No sources nor authors given in the license for " +
|
"Invalid license: No sources nor authors given in the license for " +
|
||||||
JSON.stringify(licenseInfo)
|
JSON.stringify(licenseInfo)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue