Skip to main content

Module: @kosko/config

Classes​

Type aliases​

Config​

Ƭ Config: ReadonlyDeep<Infer<typeof configSchema>>

Defined in​

packages/config/src/types.ts:40


EnvironmentConfig​

Ƭ EnvironmentConfig: ReadonlyDeep<Infer<typeof environmentConfigSchema>>

Defined in​

packages/config/src/types.ts:17

Functions​

getConfig​

▸ getConfig(config, env): Required<EnvironmentConfig>

Returns environment configs merged with global configs.

Parameters​

NameTypeDescription
configReadonlyObjectDeep<{ baseEnvironment: undefined | string ; components: undefined | string[] ; environments: undefined | Record<string, { require?: string[] | undefined; components?: string[] | undefined; }> ; extensions: undefined | string[] ; paths: undefined | { environment?: { global?: string | undefined; component?: string | undefined; } | undefined; } ; require: undefined | string[] }>Config object.
envstringEnvironment name.

Returns​

Required<EnvironmentConfig>

Defined in​

packages/config/src/config.ts:52


loadConfig​

▸ loadConfig(path): Promise<Config>

Parses and validates a config file from the specified path.

Parameters​

NameTypeDescription
pathstringPath of the config file.

Returns​

Promise<Config>

Defined in​

packages/config/src/config.ts:13


searchConfig​

▸ searchConfig(cwd?): Promise<Config>

Searchs config files in the specified directory. Returns an empty object when config files does not exist in the directory.

Parameters​

NameTypeDescription
cwdstringPath to the working directory.

Returns​

Promise<Config>

Defined in​

packages/config/src/config.ts:27


validate​

▸ validate(data): Config

Validates data with kosko configuration schema. It throws a ValidationError when validation failed.

Parameters​

NameType
dataunknown

Returns​

Config

Defined in​

packages/config/src/validate.ts:25