Add GH actions

This commit is contained in:
pietervdvn 2021-04-10 14:25:06 +02:00
parent 244bbebb0b
commit 4e1fc46ff2
3 changed files with 55 additions and 44 deletions

View file

@ -9,5 +9,23 @@
"https://wens.be/free-antwerpenize-bicycle-font",
" https://antwerpenize.be/post/634396003556081664/antwerpenize-lettertype"
]
},
{
"authors": [],
"path": "car.svg",
"license": "CC0",
"sources": []
},
{
"authors": [],
"path": "logo.svg",
"license": "CC0; trivial",
"sources": []
},
{
"authors": [],
"path": "plug.svg",
"license": "CC0; trivial",
"sources": []
}
]

View file

@ -113,4 +113,9 @@ for (const themeFile of themeFiles) {
}
}
console.log("Found ", layerErrorCount, "errors in the layers; " + themeErrorCount + " errors in the themes")
if (layerErrorCount + themeErrorCount == 0) {
console.log("All good!")
} else {
const msg = (`Found ${layerErrorCount} errors in the layers; ${themeErrorCount} errors in the themes`)
throw msg;
}

View file

@ -127,25 +127,6 @@ function createLicenseInfoFor(path): void {
writeFileSync(path + ".license_info.json", JSON.stringify(li, null, " "))
}
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]){
// Read the license info file from the generated assets, creates a compiled license info in every directory
// Note: this removes all the old license infos
@ -172,25 +153,7 @@ function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]){
}
console.log("Checking and compiling license info")
const contents = ScriptUtils.readDirRecSync("./assets")
.filter(entry => entry.indexOf("./assets/generated") != 0)
const licensePaths = contents.filter(entry => entry.indexOf("license_info.json") >= 0)
const licenseInfos = generateLicenseInfos(licensePaths);
writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfos, null, " "))
const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null)
const missingLicenses = missingLicenseInfos(licenseInfos, artwork)
console.log(`There are ${missingLicenses.length} licenses missing.`, missingLicenses)
// shuffle(missingLicenses)
// cleanLicenseInfo(licensePaths, licenseInfos)
function queryMissingLicenses(missingLicenses: string[]) {
process.on('SIGINT', function () {
console.log("Aborting... Bye!");
process.exit();
@ -207,3 +170,28 @@ for (const missingLicens of missingLicenses) {
}
console.log("You're through!")
}
console.log("Checking and compiling license info")
const contents = ScriptUtils.readDirRecSync("./assets")
.filter(entry => entry.indexOf("./assets/generated") != 0)
const licensePaths = contents.filter(entry => entry.indexOf("license_info.json") >= 0)
const licenseInfos = generateLicenseInfos(licensePaths);
writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfos, null, " "))
const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null)
const missingLicenses = missingLicenseInfos(licenseInfos, artwork)
cleanLicenseInfo(licensePaths, licenseInfos)
if(missingLicenses.length > 0){
const msg = `There are ${missingLicenses.length} licenses missing.`
/*
console.log(msg)
/*/
throw msg
//*/
}
// queryMissingLicenses(missingLicenses)