UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

78 lines 3.26 kB
import type { IConfigService } from "../../application/interface/config-service.interface"; import type { IConfig } from "../../application/interface/config.interface"; import type { IFileSystemService } from "../../application/interface/file-system-service.interface"; import type { EModule } from "../../domain/enum/module.enum"; /** * Implementation of ConfigService that uses cosmiconfig for configuration management. * Cosmiconfig searches for configuration in standard locations and formats. */ export declare class CosmicConfigService implements IConfigService { /** File system service for file operations */ readonly FILE_SYSTEM_SERVICE: IFileSystemService; private cachedConfig; private readonly EXPLORER; /** * Initializes a new instance of the CosmicConfigService. * @param fileSystemService */ constructor(fileSystemService: IFileSystemService); /** * Clears all caches. */ clearCaches(): void; /** * Checks if the configuration exists. * @returns Promise resolving to true if the configuration exists, false otherwise */ exists(): Promise<boolean>; /** * Retrieves the current configuration. * @returns Promise resolving to the configuration object */ get(): Promise<IConfig>; /** * Gets the saved configuration for a specific module. * @param module - The module to get configuration for * @returns Promise resolving to the module configuration or null if not found */ getModuleConfig<T>(module: EModule): Promise<null | T>; /** * Gets a specific property from the configuration. * @param property - The property key to retrieve * @returns Promise resolving to the value of the specified property */ getProperty<K extends keyof IConfig>(property: K): Promise<IConfig[K]>; /** * Checks if a specific module is enabled in the configuration. * @param module - The module to check * @returns Promise resolving to true if the module is enabled, false otherwise */ isModuleEnabled(module: EModule): Promise<boolean>; /** * Merges partial configuration with the existing configuration. * @param partial - Partial configuration to merge * @returns Promise that resolves when the merged configuration is saved */ merge(partial: Partial<IConfig>): Promise<void>; /** * Saves the entire configuration. * @param config - The complete configuration to save * @returns Promise that resolves when the configuration is saved */ set(config: IConfig): Promise<void>; /** * Sets a specific property in the configuration. * @param property - The property key to set * @param value - The value to assign to the property * @returns Promise that resolves when the updated configuration is saved */ setProperty<K extends keyof IConfig>(property: K, value: IConfig[K]): Promise<void>; /** * Writes configuration to a file. * @param filepath - Path to write the configuration to * @param config - Configuration to write * @returns Promise that resolves when the file is written */ private writeFile; } //# sourceMappingURL=cosmi-config-config.service.d.ts.map