@supernovaio/cli-next 2.0.34 → 2.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../src/utils/config.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAEvC,MAAM,OAAO,aAAa;IAChB,MAAM,CAAC,QAAQ,CAAe;IAC9B,WAAW,GAA2B,IAAI,CAAA;IACjC,UAAU,CAAQ;IAEnC;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../src/utils/config.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAEvC,MAAM,OAAO,aAAa;IAChB,MAAM,CAAC,QAAQ,CAAe;IAC9B,WAAW,GAA2B,IAAI,CAAA;IACjC,UAAU,CAAQ;IAEnC;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAA;IACvD,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC5B,aAAa,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;QAC9C,CAAC;QAED,OAAO,aAAa,CAAC,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E,CAAC,CAAA;QACnF,CAAC;IACH,CAAC;CACF","sourcesContent":["import * as fs from \"node:fs\"\nimport { join } from \"node:path\"\n\nimport { SupernovaConfig } from \"../types/config.js\"\n\nconst configFileName = \"supernova.json\"\n\nexport class ConfigService {\n private static instance: ConfigService\n private configCache: SupernovaConfig | null = null\n private readonly configPath: string\n\n private constructor() {\n this.configPath = join(process.cwd(), configFileName)\n }\n\n public static getInstance(): ConfigService {\n if (!ConfigService.instance) {\n ConfigService.instance = new ConfigService()\n }\n\n return ConfigService.instance\n }\n\n public get(): SupernovaConfig | null {\n if (this.configCache) return this.configCache\n if (!fs.existsSync(this.configPath)) return null\n\n try {\n const configString = fs.readFileSync(this.configPath, \"utf8\")\n const configJson = JSON.parse(configString)\n const configParseResult = SupernovaConfig.safeParse(configJson)\n\n if (configParseResult.success) {\n this.configCache = configParseResult.data\n }\n\n return this.configCache\n } catch (error) {\n throw new Error(`Could not read ${configFileName} file: ${(error as { message: string }).message}`)\n }\n }\n\n public update(configUpdate: Partial<SupernovaConfig>): void {\n const fullConfig = {\n ...this.get(),\n ...configUpdate,\n }\n\n this.write(fullConfig)\n }\n\n private write(config: SupernovaConfig): void {\n try {\n fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2))\n this.configCache = config\n } catch (error) {\n throw new Error(`Error saving config: ${(error as { message: string }).message}`)\n }\n }\n}\n"]}
|