feat: improve config values by extending default config
related to #113
This commit is contained in:
12
src/lib/config.ts
Normal file
12
src/lib/config.ts
Normal 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;
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user