forked from MapComplete/MapComplete
Feature: offline: more features to be able to work fully offline
This commit is contained in:
parent
825efdee34
commit
06aa8a3406
23 changed files with 203 additions and 60 deletions
|
@ -8,7 +8,7 @@ import {
|
|||
DoesImageExist,
|
||||
PrevalidateTheme,
|
||||
ValidateLayer,
|
||||
ValidateThemeEnsemble,
|
||||
ValidateThemeEnsemble
|
||||
} from "../src/Models/ThemeConfig/Conversion/Validation"
|
||||
import { Translation } from "../src/UI/i18n/Translation"
|
||||
import { OrderLayer, PrepareLayer } from "../src/Models/ThemeConfig/Conversion/PrepareLayer"
|
||||
|
@ -19,7 +19,7 @@ import {
|
|||
DesugaringStep,
|
||||
Each,
|
||||
Fuse,
|
||||
On,
|
||||
On
|
||||
} from "../src/Models/ThemeConfig/Conversion/Conversion"
|
||||
import { Utils } from "../src/Utils"
|
||||
import Script from "./Script"
|
||||
|
@ -182,7 +182,7 @@ class LayerBuilder extends Conversion<object, Map<string, LayerConfigJson>> {
|
|||
return `./assets/layers/${id}/${id}.json`
|
||||
}
|
||||
|
||||
writeLayer(layer: LayerConfigJson) {
|
||||
public writeLayer(layer: LayerConfigJson) {
|
||||
if (layer.labels?.some((l) => this._labelBlacklist.has(l))) {
|
||||
console.log("Not writing layer " + layer.id + ", censored")
|
||||
return
|
||||
|
@ -191,6 +191,15 @@ class LayerBuilder extends Conversion<object, Map<string, LayerConfigJson>> {
|
|||
if (!existsSync(LayerOverviewUtils.layerPath)) {
|
||||
mkdirSync(LayerOverviewUtils.layerPath)
|
||||
}
|
||||
|
||||
const usedImages = Lists.dedup(new ExtractImages(true, new Set(this._desugaringState.tagRenderings.keys()))
|
||||
.convertStrict({ layers: [layer], id: "dummy", icon: undefined, title: undefined })
|
||||
.map((x) => x.path))
|
||||
usedImages.sort()
|
||||
|
||||
layer["_usedImages"] = usedImages
|
||||
|
||||
|
||||
writeFileSync(LayerBuilder.targetPath(layer.id), JSON.stringify(layer, null, " "), {
|
||||
encoding: "utf8",
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue