Themes: move generated themes into assets, remove known_themes, support pruning of borrowed icons
This commit is contained in:
parent
310b973846
commit
ee64d84d27
18 changed files with 431 additions and 400 deletions
|
@ -180,6 +180,7 @@ class DownloadNsiLogos extends Script {
|
|||
],
|
||||
filter: [
|
||||
<any>{
|
||||
"#":"ignore-possible-duplicate",
|
||||
id: type,
|
||||
strict: true,
|
||||
options: [{ question: type }, ...filterOptions],
|
||||
|
|
|
@ -9,7 +9,7 @@ import ScriptUtils from "./ScriptUtils"
|
|||
import Translations from "../src/UI/i18n/Translations"
|
||||
import themeOverview from "../src/assets/generated/theme_overview.json"
|
||||
import ThemeConfig from "../src/Models/ThemeConfig/ThemeConfig"
|
||||
import bookcases from "../src/assets/generated/themes/bookcases.json"
|
||||
import bookcases from "../public/assets/generated/themes/bookcases.json"
|
||||
import fakedom from "fake-dom"
|
||||
import unit from "../src/assets/generated/layers/unit.json"
|
||||
import Hotkeys from "../src/UI/Base/Hotkeys"
|
||||
|
|
|
@ -140,7 +140,7 @@ class AddIconSummary extends DesugaringStep<{ raw: LayerConfigJson; parsed: Laye
|
|||
|
||||
class LayerOverviewUtils extends Script {
|
||||
public static readonly layerPath = "./src/assets/generated/layers/"
|
||||
public static readonly themePath = "./src/assets/generated/themes/"
|
||||
public static readonly themePath = "./public/assets/generated/themes/"
|
||||
|
||||
constructor() {
|
||||
super("Reviews and generates the compiled themes")
|
||||
|
@ -319,12 +319,12 @@ class LayerOverviewUtils extends Script {
|
|||
keywords,
|
||||
layers: theme.layers.filter((l) => sharedLayers.has(l["id"])).map((l) => l["id"]),
|
||||
}
|
||||
perId.set(theme.id, data)
|
||||
perId.set(data.id, data)
|
||||
}
|
||||
|
||||
const sorted = Constants.themeOrder.map((id) => {
|
||||
if (!perId.has(id)) {
|
||||
throw "Ordered theme id " + id + " not found"
|
||||
throw "Ordered theme '" + id + "' not found"
|
||||
}
|
||||
return perId.get(id)
|
||||
})
|
||||
|
|
|
@ -298,8 +298,8 @@ class GenerateLayouts extends Script {
|
|||
Origin: "https://mapcomplete.org",
|
||||
})
|
||||
urls.push(...(f.properties["connect-src"] ?? []))
|
||||
for (const key of Object.keys(styleSpec?.sources ?? {})) {
|
||||
const url = styleSpec.sources[key].url
|
||||
for (const key of Object.keys(styleSpec?.["sources"] ?? {})) {
|
||||
const url = styleSpec["sources"][key].url
|
||||
if (!url) {
|
||||
continue
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ class GenerateLayouts extends Script {
|
|||
const filename = "index_" + theme.id + ".ts"
|
||||
|
||||
const imports = [
|
||||
`import layout from "./src/assets/generated/themes/${theme.id}.json"`,
|
||||
`import layout from "./public/assets/generated/themes/${theme.id}.json"`,
|
||||
`import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"`,
|
||||
]
|
||||
for (const layerName of Constants.added_by_default) {
|
||||
|
@ -640,7 +640,7 @@ class GenerateLayouts extends Script {
|
|||
if (theme !== undefined) {
|
||||
console.warn("Only generating layout " + theme)
|
||||
}
|
||||
const paths = ScriptUtils.readDirRecSync("./src/assets/generated/themes/",1)
|
||||
const paths = ScriptUtils.readDirRecSync("./public/assets/generated/themes/",1)
|
||||
for (const i in paths) {
|
||||
const layoutConfigJson = <ThemeConfigJson> JSON.parse(readFileSync(paths[i], "utf8"))
|
||||
if (theme !== undefined && layoutConfigJson.id !== theme) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
mkdir -p ./src/assets/generated/layers
|
||||
echo '{"layers": []}' > ./src/assets/generated/known_layers.json
|
||||
rm -f ./src/assets/generated/layers/*.json
|
||||
rm -f ./src/assets/generated/themes/*.json
|
||||
rm -f ./public/assets/generated/themes/*.json
|
||||
cp ./assets/layers/usersettings/usersettings.json ./src/assets/generated/layers/usersettings.json
|
||||
echo '{}' > ./src/assets/generated/layers/favourite.json
|
||||
echo '{}' > ./src/assets/generated/layers/summary.json
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue