UNPKG

kubricate

Version:

A TypeScript framework for building reusable, type-safe Kubernetes infrastructure — without the YAML mess.

25 lines 983 B
import c from 'ansis'; import { loadConfig } from 'unconfig'; import '@kubricate/core'; import { MARK_CHECK } from './constant.js'; import { SilentLogger } from './logger.js'; export const DEFAULT_CONFIG_NAME = 'kubricate.config'; // Allow all JS/TS file extensions except JSON export const DEFAULT_CONFIG_EXTENSIONS = ['mts', 'cts', 'ts', 'mjs', 'cjs', 'js']; export function getMatchConfigFile() { return `${DEFAULT_CONFIG_NAME}.{${DEFAULT_CONFIG_EXTENSIONS.join(',')}}`; } export async function getConfig(options, logger = new SilentLogger()) { const result = await loadConfig({ cwd: options.root, sources: [{ files: options.config || DEFAULT_CONFIG_NAME, // Allow all JS/TS file extensions except JSON extensions: DEFAULT_CONFIG_EXTENSIONS }], merge: false }); if (result.sources.length) logger.log(c.green`${MARK_CHECK} Config loaded from ${result.sources.join(', ')}`); return result.config; } //# sourceMappingURL=load-config.js.map