Module: @kosko/config#

Index#

References#

Classes#

Interfaces#

Functions#

References#

Config#

Re-exports: Config


EnvironmentConfig#

Re-exports: EnvironmentConfig


ValidationError#

Re-exports: ValidationError


getConfig#

Re-exports: getConfig


loadConfig#

Re-exports: loadConfig


searchConfig#

Re-exports: searchConfig


validate#

Re-exports: validate

Functions#

getConfig#

getConfig(config: Config, env: string): Required<EnvironmentConfig>

Defined in packages/config/src/config.ts:57

Returns environment configs merged with global configs.

Parameters:#

NameTypeDescription
configConfigConfig object.
envstringEnvironment name.

Returns: Required<EnvironmentConfig>


loadConfig#

loadConfig(path: string): Promise<Config>

Defined in packages/config/src/config.ts:17

Parses and validates a config file from the specified path.

Parameters:#

NameTypeDescription
pathstringPath of the config file.

Returns: Promise<Config>


searchConfig#

searchConfig(cwd?: string): Promise<Config>

Defined in packages/config/src/config.ts:32

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

Parameters:#

NameTypeDefault valueDescription
cwdstringprocess.cwd()Path to the working directory.

Returns: Promise<Config>


validate#

validate(data: unknown): void

Defined in packages/config/src/validate.ts:25

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

Parameters:#

NameTypeDescription
dataunknown

Returns: void