Scripts: actually stop the build if the layer contains an error

This commit is contained in:
Pieter Vander Vennet 2025-03-30 23:41:01 +02:00
parent 94412c996b
commit 2fdec3769a
3 changed files with 6 additions and 8 deletions

View file

@ -24,7 +24,7 @@ export default abstract class Script {
}) })
.catch((e) => { .catch((e) => {
console.log(`ERROR in script ${process.argv[1]}:`, e) console.log(`ERROR in script ${process.argv[1]}:`, e)
// process.exit(1) process.exit(1)
}) })
} }

View file

@ -9,16 +9,12 @@ import {
DoesImageExist, DoesImageExist,
PrevalidateTheme, PrevalidateTheme,
ValidateLayer, ValidateLayer,
ValidateThemeEnsemble, ValidateThemeEnsemble
} from "../src/Models/ThemeConfig/Conversion/Validation" } from "../src/Models/ThemeConfig/Conversion/Validation"
import { Translation } from "../src/UI/i18n/Translation" import { Translation } from "../src/UI/i18n/Translation"
import { PrepareLayer } from "../src/Models/ThemeConfig/Conversion/PrepareLayer" import { PrepareLayer } from "../src/Models/ThemeConfig/Conversion/PrepareLayer"
import { PrepareTheme } from "../src/Models/ThemeConfig/Conversion/PrepareTheme" import { PrepareTheme } from "../src/Models/ThemeConfig/Conversion/PrepareTheme"
import { import { Conversion, DesugaringContext, DesugaringStep } from "../src/Models/ThemeConfig/Conversion/Conversion"
Conversion,
DesugaringContext,
DesugaringStep,
} from "../src/Models/ThemeConfig/Conversion/Conversion"
import { Utils } from "../src/Utils" import { Utils } from "../src/Utils"
import Script from "./Script" import Script from "./Script"
import { AllSharedLayers } from "../src/Customizations/AllSharedLayers" import { AllSharedLayers } from "../src/Customizations/AllSharedLayers"
@ -654,6 +650,9 @@ class LayerOverviewUtils extends Script {
if (sharedLayers.has(fixed.id)) { if (sharedLayers.has(fixed.id)) {
throw "There are multiple layers with the id " + fixed.id + ", " + sharedLayerPath throw "There are multiple layers with the id " + fixed.id + ", " + sharedLayerPath
} }
if (parsed.context.hasErrors()) {
throw "Some layers contain errors"
}
sharedLayers.set(fixed.id, fixed) sharedLayers.set(fixed.id, fixed)
recompiledLayers.push(fixed.id) recompiledLayers.push(fixed.id)

View file

@ -22,7 +22,6 @@ npm run generate && # includes a single "refresh:layeroverview". Resetting the f
npm run generate:mapcomplete-changes-theme && npm run generate:mapcomplete-changes-theme &&
npm run refresh:layeroverview && # a second time to propagate all calls npm run refresh:layeroverview && # a second time to propagate all calls
npm run refresh:layeroverview && # a third time to fix some issues with the favourite layer all calls npm run refresh:layeroverview && # a third time to fix some issues with the favourite layer all calls
npm run generate:layouts npm run generate:layouts
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then