mapcomplete/scripts/lint.ts

21 lines
724 B
TypeScript
Raw Normal View History

2021-09-26 18:21:29 +02:00
import ScriptUtils from "./ScriptUtils";
import {writeFileSync} from "fs";
import LegacyJsonConvert from "../Models/ThemeConfig/LegacyJsonConvert";
2021-09-26 18:21:29 +02:00
/*
* This script reads all theme and layer files and reformats them inplace
* Use with caution, make a commit beforehand!
2021-09-26 19:56:40 +02:00
*/
const layerFiles = ScriptUtils.getLayerFiles();
for (const layerFile of layerFiles) {
2021-11-07 16:34:51 +01:00
LegacyJsonConvert.fixLayerConfig(layerFile.parsed)
writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, " "))
2021-09-26 19:56:40 +02:00
}
2021-09-26 19:59:51 +02:00
2021-09-26 19:56:40 +02:00
const themeFiles = ScriptUtils.getThemeFiles()
for (const themeFile of themeFiles) {
2021-11-07 16:34:51 +01:00
LegacyJsonConvert.fixThemeConfig(themeFile.parsed)
2021-09-26 19:59:51 +02:00
writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, " "))
2021-09-26 19:58:11 +02:00
}