feat: improve config values by extending default config

related to #113
This commit is contained in:
Mathias Schopmans
2024-03-13 14:19:53 +01:00
parent c5186353a6
commit 04053c6700
7 changed files with 146 additions and 135 deletions

12
src/lib/config.ts Normal file
View File

@@ -0,0 +1,12 @@
import defaultConfig from "../../data/config.default.json";
import _userConfig from "../../data/config.json";
const userConfig = _userConfig as typeof defaultConfig;
const config = { ...defaultConfig, ...userConfig };
if (userConfig.colors)
config.colors = { ...defaultConfig.colors, ...userConfig.colors };
if (userConfig.labels)
config.labels = { ...defaultConfig.labels, ...userConfig.labels };
export default config;

View File

@@ -1,5 +1,5 @@
import config from "../../data/config.json";
import data from "../../data/data.json";
import config from "./config";
import { format } from "@/lib/format";
import { Flag, Item, Quadrant, Ring } from "@/lib/types";