chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-08-14 13:53:56 +02:00
parent f77570589d
commit 9b8a9337fd
111 changed files with 2911 additions and 1280 deletions

View file

@ -172,14 +172,13 @@ export default class ScriptUtils {
headers?: any,
timeoutSecs?: number
): Promise<{ content: string } | { redirect: string } | "timeout"> {
if(url.startsWith("./assets")){
return Promise.resolve({content: readFileSync("./public/"+url, "utf8")})
if (url.startsWith("./assets")) {
return Promise.resolve({ content: readFileSync("./public/" + url, "utf8") })
}
if(url.startsWith("./")){
return Promise.resolve({content: readFileSync(url, "utf8")})
if (url.startsWith("./")) {
return Promise.resolve({ content: readFileSync(url, "utf8") })
}
const requestPromise = new Promise((resolve, reject) => {
try {
headers = headers ?? {}

View file

@ -100,14 +100,17 @@ class DownloadEli extends Script {
const contents =
'{"type":"FeatureCollection",\n "features": [\n' +
keptLayers.filter(l => l.properties.id !== "Bing").map((l) => JSON.stringify(l)).join(",\n") +
keptLayers
.filter((l) => l.properties.id !== "Bing")
.map((l) => JSON.stringify(l))
.join(",\n") +
"\n]}"
const bing = keptLayers.find(l => l.properties.id === "Bing")
if(bing){
const bing = keptLayers.find((l) => l.properties.id === "Bing")
if (bing) {
fs.writeFileSync(targetBing, JSON.stringify(bing), { encoding: "utf8" })
console.log("Written", targetBing)
}else{
} else {
console.log("No bing entry found")
}
fs.writeFileSync(target, contents, { encoding: "utf8" })

View file

@ -273,7 +273,6 @@ class LayerOverviewUtils extends Script {
JSON.stringify(theme, null, " "),
{ encoding: "utf8" }
)
}
writeLayer(layer: LayerConfigJson) {
@ -852,7 +851,11 @@ class LayerOverviewUtils extends Script {
}
}
const usedImages = Utils.Dedup(new ExtractImages(true, knownTagRenderings).convertStrict(themeFile).map(x => x.path))
const usedImages = Utils.Dedup(
new ExtractImages(true, knownTagRenderings)
.convertStrict(themeFile)
.map((x) => x.path)
)
usedImages.sort()
themeFile["_usedImages"] = usedImages

View file

@ -74,7 +74,12 @@ class HandleErrors extends Script {
}
for (const parsed of all) {
console.log(parsed.message.username, parsed.message.layout, parsed.message.message, parsed.date)
console.log(
parsed.message.username,
parsed.message.layout,
parsed.message.message,
parsed.date
)
const e = parsed.message
const neededIds = Changes.GetNeededIds(e.pendingChanges)
@ -112,7 +117,7 @@ class HandleErrors extends Script {
"Changes for " + parsed.index + ": empty changeset, not creating a file for it"
)*/
} else if (createdChangesets.has(changeset)) {
/* console.log(
/* console.log(
"Changeset " +
parsed.index +
" is identical to previously seen changeset, not writing to file"
@ -126,7 +131,7 @@ ${changeset}`
}
const refusedContent = JSON.stringify(refused)
if (refusedFiles.has(refusedContent)) {
/* console.log(
/* console.log(
"Refused changes for " +
parsed.index +
" is identical to previously seen changeset, not writing to file"