From eda66b7e6909e5af4cac51ee8eb7f2d702cc3ecb Mon Sep 17 00:00:00 2001 From: quinm0 Date: Sun, 26 Apr 2026 21:48:08 -0400 Subject: [PATCH] messing with more just riffin at this point --- bun/soupclown/index.ts | 8 ++------ bun/soupclown/src/interface/config.ts | 24 ++++++++++++++++++++++-- config.soupclown.json | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/bun/soupclown/index.ts b/bun/soupclown/index.ts index e481ac8..ca04d68 100644 --- a/bun/soupclown/index.ts +++ b/bun/soupclown/index.ts @@ -1,7 +1,3 @@ -import { SC_DOCKER } from "./src/interface/docker"; -import './src/interface/config' -// const containers = await DockerSC.PS(); -// containers.forEach(container => { -// console.log(`Name: ${container.Names}`) -// }); +import { SC_CONFIG } from "./src/interface/config"; +console.log('config', SC_CONFIG.config) \ No newline at end of file diff --git a/bun/soupclown/src/interface/config.ts b/bun/soupclown/src/interface/config.ts index 4749537..70f0d32 100644 --- a/bun/soupclown/src/interface/config.ts +++ b/bun/soupclown/src/interface/config.ts @@ -13,7 +13,16 @@ const CONFIG_SCHEMA = z.object({ ]), }); export type CONFIG_SCHEMA_T = z.infer +const NEW_CONFIG: CONFIG_SCHEMA_T = { + v: 'v1', + config: { + services: new Map() + } +}; +async function _initConfigFile(path: string){ + await Bun.write(path, JSON.stringify(NEW_CONFIG)); +} async function _loadConfig(path = DEFAULT_CONFIG_PATH){ const configFile = Bun.file(path); @@ -21,18 +30,29 @@ async function _loadConfig(path = DEFAULT_CONFIG_PATH){ try{ fileJsonData = await configFile.json(); + console.log('json data', fileJsonData) }catch(e){ console.error('failed to parse json IG') + throw "failed" } const configParseJsonResult = CONFIG_SCHEMA.safeParse(fileJsonData); if(!configParseJsonResult.success){ - throw "Fuck"; + console.error('parsing error, overwrting config :3', configParseJsonResult.error) + await _initConfigFile(path); + return NEW_CONFIG; } return configParseJsonResult.data as CONFIG_SCHEMA_T; } -export const SC_CONFIG = _loadConfig(); \ No newline at end of file +async function methodWrapper(config: CONFIG_SCHEMA_T){ + const newConfig: CONFIG_SCHEMA_T & { + + } = config; + +} + +export const SC_CONFIG = await _loadConfig(); \ No newline at end of file diff --git a/config.soupclown.json b/config.soupclown.json index 301e410..442d504 100644 --- a/config.soupclown.json +++ b/config.soupclown.json @@ -1 +1 @@ -{ "name": "my-package" } \ No newline at end of file +{"v":"v1","config":{"services":{}}} \ No newline at end of file